cv_random_line: Random line cross validation folds generation

View source: R/utils.R

cv_random_lineR Documentation

Random line cross validation folds generation

Description

This method is designed in the context of genomic selection where we have a vector of lines and we want to generate folds for cross validation. In each fold a proportion of lines is taken to be the testing set and the remaining ones to be the training set.

Usage

cv_random_line(lines, folds_number = 5, testing_proportion = 0.2)

Arguments

lines

(vector) The vector of all lines.

folds_number

(numeric(1)) The number of folds to generate.

testing_proportion

(numeric(1)) The proportion of lines to be taken to be the testing set in each fold.

Value

A list with folds_number elements where each element is a named list with the elements training wich includes the indices of those records to be part of the training set and testing wich includes the indices of those records to be part of the testing set. Training and testing sets of each fold are exhaustive and mutually exclusive.

Examples

## Not run: 
# Generates random data
lines <- rep(paste0("line", 1:10), 4)
folds <- cv_random_line(lines, 5, 0.2)
# Indices of training set in fold 1
folds[[1]]$training
# Indices of testing set in fold 1
folds[[1]]$testing

## End(Not run)


brandon-mosqueda/SKM documentation built on Feb. 8, 2025, 5:24 p.m.