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")))
Run the code above in your browser using DataLab