View source: R/PredictionClassif.R
autoplot.PredictionClassif | R Documentation |
Visualizations for mlr3::PredictionClassif.
The argument type
controls what kind of plot is drawn.
Possible choices are:
"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.
"threshold"
: Systematically varies the threshold of the mlr3::PredictionClassif object and plots the resulting performance as returned by measure
.
## S3 method for class 'PredictionClassif'
autoplot(
object,
type = "stacked",
measure = NULL,
theme = theme_minimal(),
...
)
object |
(mlr3::PredictionClassif). |
type |
(character(1)): |
measure |
(mlr3::Measure) |
theme |
( |
... |
(ignored). |
ggplot2::ggplot()
.
Saito T, Rehmsmeier M (2017). “Precrec: fast and accurate precision-recall and ROC curve calculations in R.” Bioinformatics, 33(1), 145-147. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bioinformatics/btw570")}.
if (requireNamespace("mlr3")) {
library(mlr3)
library(mlr3viz)
task = tsk("spam")
learner = lrn("classif.rpart", predict_type = "prob")
object = learner$train(task)$predict(task)
head(fortify(object))
autoplot(object)
autoplot(object, type = "roc")
autoplot(object, type = "prc")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.