View source: R/Prediction_operators.R
getPredictionProbabilities | R Documentation |
Get probabilities for some classes.
getPredictionProbabilities(pred, cl)
pred |
(Prediction) |
cl |
(character) |
(data.frame) with numerical columns or a numerical vector if length of cl
is 1.
Order of columns is defined by cl
.
Other predict:
asROCRPrediction()
,
getPredictionResponse()
,
getPredictionTaskDesc()
,
predict.WrappedModel()
,
setPredictThreshold()
,
setPredictType()
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")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.