create.folds: Cross-validation folds

View source: R/helpers.R

create.foldsR Documentation

Cross-validation folds

Description

Create a list of indices corresponding to cross-validation folds.

Usage

create.folds(num.folds, num.rows, seed = NULL)

Arguments

num.folds

Number of folds to be created.

num.rows

Number of observations in the dataset.

seed

Seed of the random number generator. If NULL, the folds generated will be different at each invocation; for reproducibility of results, it is recommended to set this to a specific value.

Value

A list of length num.folds containing the indices of the observations to be withdrawn for validation in each fold.

Note

Note that the number of observations withdrawn in each fold may not be exactly the same if num.folds is not an integer divisor of num.rows.

Examples

all.folds <- create.folds(50, 307, 0)

nestfs documentation built on Dec. 28, 2022, 1:27 a.m.