makeFolds: Make k sets of indices to samples for k-fold cross-validation

View source: R/kFoldSet.R

makeFoldsR Documentation

Make k sets of indices to samples for k-fold cross-validation

Description

The function randomly allocates sample indices to k numeric vectors. The length of each vector is determined as the nearest integer to the number of samples times the test fraction.

Usage

makeFolds(numSamples, k, testSplit = 0.2)

Arguments

numSamples

Integer. The number of samples to be partitioned into k folds.

k

Integer. The number of folds.

testSplit

Numeric. The fraction of samples to be used in making the test set

Value

A list of numeric vectors of length k, where the elements of each vector are the indices of the samples forming the TEST set for that fold.

Examples

## Not run:  ## Default testSplit
these_folds <- fitMaxnet::makeFolds(324, 5)
## User-selected testSplit
these_folds <- fitMaxnet::makeFolds(261, 5, 0.3) 
## End(Not run)

peterbat1/fitMaxnet documentation built on Sept. 17, 2024, 10:50 p.m.