Learn R Programming

rminer (version 1.1)

crossvaldata: Computes k-fold cross validation for rminer models.

Description

Computes k-fold cross validation for rminer models.

Usage

crossvaldata(x, data, theta.fit, theta.predict, ngroup = n, 
             order = FALSE, model, task, feature = "none",
             ...)

Arguments

x
See fit for details.
data
See fit for details.
theta.fit
fitting function
theta.predict
prediction function
ngroup
number of folds
order
if TRUE then a static ordered sampling cross-validation is adopted (e.g. useful for time series data), else the normal random sampling is adopted.
model
See fit for details.
task
See fit for details.
feature
See fit for details.
...
Additional parameters sent to theta.fit (e.g. search, mpar, scale, transform)

Value

  • Returns a list with:
    • $cv.fit -- all predictions (factor iftask="class", matrix iftask="prob"or numeric iftask="reg");
    • $mpar -- matrix with the mpar for each fold;
    • $attributes -- the selected attributes for each fold if a feature selection algorithm was adopted;
    • $ngroup -- the number of folds;
    • $leave.out -- the computed size for each fold (=nrow(data)/ngroup);
    • $groups -- vector list with the indexes of each group;
    • $call -- the call of this function;

Details

Standard k-fold cross-validation but adopted for rminer models. For classification tasks ("class" or "prob") a stratified sampling is used (the class distributions are identical for each fold).

References

Check the crossval function of the bootstrap library.

See Also

holdout, fit, mining and predict.fit.

Examples

Run this code
data(iris)
 M=crossvaldata(Species~.,iris,fit,predict,ngroup=3,model="mlpe",
                task="prob",search=4,mpar=c(3,100,"holdout",2/3,"AUC"))

Run the code above in your browser using DataLab