datasplit | R Documentation |
This function is a data splitting function for k-fold cross- validation and uses a stratified random sampling technique. It resamples the training data based on sample quantiles.
datasplit(trainy, k.fold = 10)
trainy |
a vector of response, must have a length equal to sample size. |
k.fold |
integer; number of folds in the cross-validation. if > 1, then apply k-fold cross validation; the default is 10, i.e., 10-fold cross validation that is recommended. |
A list of samples each with an index of k-fold number.
This function is largely based on rfcv in randomForest.
Jin Li
A. Liaw and M. Wiener (2002). Classification and Regression by randomForest. R News 2(3), 18-22.
library(spm)
data(petrel)
idx1 <- datasplit(petrel[, 3], k.fold = 10)
table(idx1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.