getPredictionProbabilities: Get probabilities for some classes.

View source: R/Prediction_operators.R

getPredictionProbabilitiesR Documentation

Get probabilities for some classes.

Description

Get probabilities for some classes.

Usage

getPredictionProbabilities(pred, cl)

Arguments

pred

(Prediction)
Prediction object.

cl

(character)
Names of classes. Default is either all classes for multi-class / multilabel problems or the positive class for binary classification.

Value

(data.frame) with numerical columns or a numerical vector if length of cl is 1. Order of columns is defined by cl.

See Also

Other predict: asROCRPrediction(), getPredictionResponse(), getPredictionTaskDesc(), predict.WrappedModel(), setPredictThreshold(), setPredictType()

Examples

task = makeClassifTask(data = iris, target = "Species")
lrn = makeLearner("classif.lda", predict.type = "prob")
mod = train(lrn, task)
# predict probabilities
pred = predict(mod, newdata = iris)

# Get probabilities for all classes
head(getPredictionProbabilities(pred))

# Get probabilities for a subset of classes
head(getPredictionProbabilities(pred, c("setosa", "virginica")))

berndbischl/mlr documentation built on Aug. 15, 2024, 4:20 p.m.