Generates plots for mlr3::PredictionClassif, depending on argument type:

  • "stacked" (default): Stacked barplot of true and estimated class labels.

  • "roc": ROC curve (1 - specificity on x, sensitivity on y). Requires package precrec.

  • "prc": Precision recall curve. Requires package precrec.

# S3 method for PredictionClassif
autoplot(object, type = "stacked", ...)

Arguments

object

(mlr3::PredictionClassif).

type

(character(1)):
Type of the plot.

...

(any): Additional arguments, passed down to the respective geom.

Value

ggplot2::ggplot() object.

Examples

library(mlr3) library(mlr3viz) task = tsk("spam") learner = lrn("classif.rpart", predict_type = "prob") object = learner$train(task)$predict(task) head(fortify(object))
#> row_id truth response prob.nonspam prob.spam #> 1: 1 spam spam 0.14864865 0.8513514 #> 2: 2 spam spam 0.06603774 0.9339623 #> 3: 3 spam spam 0.06603774 0.9339623 #> 4: 4 spam spam 0.09090909 0.9090909 #> 5: 5 spam spam 0.09090909 0.9090909 #> 6: 6 spam nonspam 0.89952503 0.1004750
autoplot(object)
autoplot(object, type = "roc")
autoplot(object, type = "prc")