CV: Perform a k-fold Cross-validation

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/CV.R

Description

Performs the usual k-fold cross-validation procedure on a given data set, parameter grid and learner.

Usage

1
CV(data, learner, params, fold = 5, verbose = TRUE)

Arguments

data

The data set as CVST.data object.

learner

The learner as CVST.learner object.

params

the parameter grid as CVST.params object.

fold

The number of folds that should be generated for each set of parameters.

verbose

Should the procedure report the performance for each model?

Value

Returns the optimal parameter settings as determined by k-fold cross-validation.

Author(s)

Tammo Krueger <tammokrueger@googlemail.com>

References

M. Stone. Cross-validatory choice and assessment of statistical predictions. Journal of the Royal Statistical Society. Series B, 36(2):111–147, 1974.

Sylvain Arlot, Alain Celisse, and Paul Painleve. A survey of cross-validation procedures for model selection. Statistics Surveys, 4:40–79, 2010.

See Also

fastCV constructData constructLearner constructParams

Examples

1
2
3
4
ns = noisySine(100)
svm = constructSVMLearner()
params = constructParams(kernel="rbfdot", sigma=10^(-3:3), nu=c(0.05, 0.1, 0.2, 0.3))
opt = CV(ns, svm, params)

Example output

Loading required package: kernlab
Loading required package: Matrix
kernel=rbfdot sigma=0.001 nu=0.05 ( 0.42 )
kernel=rbfdot sigma=0.01 nu=0.05 ( 0.51 )
kernel=rbfdot sigma=0.1 nu=0.05 ( 0.18 )
kernel=rbfdot sigma=1 nu=0.05 ( 0.19 )
kernel=rbfdot sigma=10 nu=0.05 ( 0.22 )
kernel=rbfdot sigma=100 nu=0.05 ( 0.3 )
kernel=rbfdot sigma=1000 nu=0.05 ( 0.4 )
kernel=rbfdot sigma=0.001 nu=0.1 ( 0.53 )
kernel=rbfdot sigma=0.01 nu=0.1 ( 0.61 )
kernel=rbfdot sigma=0.1 nu=0.1 ( 0.15 )
kernel=rbfdot sigma=1 nu=0.1 ( 0.14 )
kernel=rbfdot sigma=10 nu=0.1 ( 0.19 )
kernel=rbfdot sigma=100 nu=0.1 ( 0.3 )
kernel=rbfdot sigma=1000 nu=0.1 ( 0.4 )
kernel=rbfdot sigma=0.001 nu=0.2 ( 0.6 )
kernel=rbfdot sigma=0.01 nu=0.2 ( 0.44 )
kernel=rbfdot sigma=0.1 nu=0.2 ( 0.12 )
kernel=rbfdot sigma=1 nu=0.2 ( 0.13 )
kernel=rbfdot sigma=10 nu=0.2 ( 0.17 )
kernel=rbfdot sigma=100 nu=0.2 ( 0.3 )
kernel=rbfdot sigma=1000 nu=0.2 ( 0.4 )
kernel=rbfdot sigma=0.001 nu=0.3 ( 0.41 )
kernel=rbfdot sigma=0.01 nu=0.3 ( 0.4 )
kernel=rbfdot sigma=0.1 nu=0.3 ( 0.12 )
kernel=rbfdot sigma=1 nu=0.3 ( 0.13 )
kernel=rbfdot sigma=10 nu=0.3 ( 0.17 )
kernel=rbfdot sigma=100 nu=0.3 ( 0.3 )
kernel=rbfdot sigma=1000 nu=0.3 ( 0.4 )

CVST documentation built on May 2, 2019, 3:43 p.m.