cv {gcl}R Documentation

N-fold crossvalidation

Description

A function to do n-fold crossvalidation of a classifier function on a data set.

Usage

cv(df, mb, eval, fold = 2, seed = NULL, q.only = T, cv.verbose = F, ...)

Arguments

df Data set (frame)
mb Model builder, must return a function that takes df as input and returns a matrix where entry (i,j) is the classifiers belief of case i's memebership in class j
eval Evaluation function, takes as input classifier generated by mb above and data frame df
fold How many folds.
seed Set random seed to this (for reproducibility)
q.only Return evaluation results only.
cv.verbose If TRUE, output info.
... Passed on.

Value

If q.only is TRUE then the function returns a vector of evaluation results. Otherwise it returns a list.

cf The classifiers generated for each fold.
q The evaluation results of each classifier on df

Author(s)

Staal A. Vinterbo staal@dsg.harvard.edu

Examples

## Not run: 
cv(df, gcl, acc.eval)
## End(Not run)

[Package gcl version 1.06.5 Index]