Learn R Programming

vimp (version 1.1.2)

two_validation_set_cv: V-fold cross-validation with two validation sets

Description

Set up V-fold cross-validation, where rather than the usual train/test split for each fold, now there are two test datasets. In practice, this means that each datum is in the training data V - 2 times, in the first test set once, and in the second test set once.

Usage

two_validation_set_cv(n, V)

Arguments

n

the sample size

V

the number of folds

Value

an n by V matrix containing the train/test set 1/test set 2 data for each fold.

Details

This method is only different from V-fold cross-validation by how much data is used in the training sample, and the fact that two validation samples are needed. Specifically, in two-validation-set V-fold CV, n/V fewer observations are used in training than in V-fold CV. These n/V observations are used in the second validation set.

Examples

Run this code
# NOT RUN {
n <- 100
V <- 5
## set up two-validation-set 5-fold CV
folds <- two_validation_set_cv(n, V)

# }

Run the code above in your browser using DataLab