CV-class: Class "CV"

Description Objects from the Class Slots Extends Methods Author(s) References See Also Examples

Description

This class of objects contains the information describing a cross validation experiment, i.e. its settings.

Objects from the Class

Objects can be created by calls of the form CV(...) providing the values for the class slots. These objects include information on the number of repetitions of the cross validation (CV) experiment, the number of folds, the random number generator seed, whether the sampling should or not be stratified and optionally, the concrete data splits to use on each repetition and iteration of the CV experiment. Note that most of the times you will not supply these data splits as the CV routines in this infra-structure will take care of building them. Still, this allows you to replicate some experiment carried out with specific train/test splits.

Slots

nReps:

Object of class numeric indicating the number of repetitions of the N folds CV experiment (defaulting to 1).

nFolds:

Object of class numeric with the number of folds on each CV experiment (defaulting to 10).

strat:

Object of class logical indicating whether the sampling should or not be stratified (defaulting to FALSE).

seed:

Object of class numeric with the random number generator seed (defaulting to 1234).

dataSplits:

Object of class list containing the data splits to use on each repetition of a k-folds CV experiment (defaulting to NULL). This list should contain nReps x nFolds elements. Each element should be a vector with the row ids of the test set of the respective iteration. For instance, on a 3 x 10-fold CV experiment the 10th element should contain the ids of the test cases of the 10th fold of the first repetition and the 11th element the ids of the test cases on the 1st fold of the 2nd repetition. On all these iterations the training set will be formed by the ids not appearing in the test set.

Extends

Class EstCommon, directly. Class EstimationMethod, directly.

Methods

show

signature(object = "CV"): method used to show the contents of a CV object.

Author(s)

Luis Torgo ltorgo@dcc.fc.up.pt

References

Torgo, L. (2014) An Infra-Structure for Performance Estimation and Experimental Comparison of Predictive Models in R. arXiv:1412.0436 [cs.MS] http://arxiv.org/abs/1412.0436

See Also

MonteCarlo, LOOCV, Bootstrap, Holdout, EstimationMethod, EstimationTask

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
showClass("CV")

## the defaults (1 x 10-fold CV)
s <- CV()

## stratified 2 x 5-fold CV
s1 <- CV(nReps=2,nFolds=5,strat=TRUE)

## Small example illustrating the format of user supplied data splits.
## This could be a 3-fold CV process of a data set with 30 cases
s2 <- CV(dataSplits=list(1:10,11:20,21:30))
s2

performanceEstimation documentation built on May 2, 2019, 6:01 a.m.