Learn R Programming

SLOPE (version 1.0.0)

createFolds: Create cross-validation folds

Description

Internal function that creates fold assignments for k-fold cross-validation, with support for repeated cross-validation.

Usage

createFolds(n, n_folds, n_repeats = 1)

Value

A list of length n_repeats. Each element contains a list of n_folds integer vectors representing the indices (0-based) of observations in each fold.

Arguments

n

Integer. Number of observations to split into folds.

n_folds

Integer. Number of folds to create.

n_repeats

Integer. Number of times to repeat the cross-validation process with different fold assignments. Default is 1.