lol.xval.split {lolR} | R Documentation |
Cross-Validation Data Splitter
Description
A function to split a dataset into training and testing sets for cross validation. The procedure for cross-validation
is to split the data into k-folds. The k-folds are then rotated individually to form a single held-out testing set the model will be validated on,
and the remaining (k-1) folds are used for training the developed model. Note that this cross-validation function includes functionality to be used for
low-rank cross-validation. In that case, instead of using the full (k-1) folds for training, we subset min((k-1)/k*n, d)
samples to ensure that
the resulting training sets are all low-rank. We still rotate properly over the held-out fold to ensure that the resulting testing sets
do not have any shared examples, which would add a complicated dependence structure to inference we attempt to infer on the testing sets.
Usage
lol.xval.split(X, Y, k = "loo", rank.low = FALSE, ...)
Arguments
X |
|
Y |
|
k |
the cross-validated method to perform. Defaults to
|
rank.low |
whether to force the training set to low-rank. Defaults to
|
... |
optional args. |
Value
sets the cross-validation sets as an object of class "XV"
containing the following:
train |
length |
test |
length |
Author(s)
Eric Bridgeford
Examples
# prepare data for 10-fold validation
library(lolR)
data <- lol.sims.rtrunk(n=200, d=30) # 200 examples of 30 dimensions
X <- data$X; Y <- data$Y
sets.xval.10fold <- lol.xval.split(X, Y, k=10)
# prepare data for loo validation
sets.xval.loo <- lol.xval.split(X, Y, k='loo')