generate_kfold_indices | R Documentation |
This function generates indices for K-fold cross-validation based on the total sample size 'N' and the number of folds 'Kfold'. If 'reverse = TRUE', the remainder indices will be assigned in reverse order.
generate_kfold_indices(N, Kfold, reverse = FALSE)
N |
Integer. Total sample size (number of observations). |
Kfold |
Integer. The number of folds to split the data into. |
reverse |
Logical. Whether to reverse the remainder indices when 'N' is not divisible by 'Kfold'. Defaults to 'FALSE'. |
A vector of length 'N' containing the fold assignments (from 1 to 'Kfold').
Thomas Debray
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.