Skip to contents

Learners like randomForest produce out-of-bag predictions. getOOBPreds extracts this information from trained models and builds a prediction object as provided by predict (with prediction time set to NA). In the classification case: What is stored exactly in the (Prediction) object depends on the predict.type setting of the Learner.

You can call listLearners(properties = "oobpreds") to get a list of learners which provide this.

Usage

getOOBPreds(model, task)

Arguments

model

(WrappedModel)
The model.

task

(Task)
The task.

Value

(Prediction).

Examples

training.set = sample(1:150, 50)
lrn = makeLearner("classif.ranger", predict.type = "prob", predict.threshold = 0.6)
mod = train(lrn, sonar.task, subset = training.set)
#> Error in x[0, , drop = FALSE]: incorrect number of dimensions
oob = getOOBPreds(mod, sonar.task)
#> Error in checkClass(x, classes, ordered, null.ok): object 'mod' not found
oob
#> Error in eval(expr, envir, enclos): object 'oob' not found
performance(oob, measures = list(auc, mmce))
#> Error in performance(oob, measures = list(auc, mmce)): object 'oob' not found