Learn R Programming

emil (version 1.1-6)

resample.mapply: Compare true response to resampled predictions

Description

This function can be used to compare a true response vector to predictions returned from evaluate.modeling. For each fold, the correct subset of the true response vector is extracted and fed to a given function together with the matching predictions.

Usage

resample.mapply(fun, resample, true, pred, ...)

Arguments

fun
Function to run.
resample
Resampling scheme (see resample).
true
True response vector.
pred
Predictions, as returned from evaluate.modeling.
...
Sent to mapply.

Examples

Run this code
proc <- modeling.procedure("lda")
ho <- resample("holdout", iris$Species, frac=1/3, nfold=4)
perf <- evaluate.modeling(proc, iris[-5], iris$Species, resample=ho)
confusion.tables <- resample.mapply(
    function(truth, prediction) table(truth, prediction$pred$pred),
    ho, iris$Species, pred=perf, SIMPLIFY=FALSE)
Reduce("+", confusion.tables)

Run the code above in your browser using DataLab