2

In mlr there was a function to draw calibration plots:

## mlr approach
# train predict
library(mlr)
lrn = makeLearner("classif.rpart", predict.type = "prob")
mod = train(lrn, task = sonar.task)
pred = predict(mod, task = sonar.task)

# make calibration plot
cal = generateCalibrationData(pred)
plotCalibration(cal, smooth=TRUE)
#> `geom_smooth()` using formula 'y ~ x'

Now I wonder how I could draw a nice calibration plot in mlr3 using the output of learner$train(task)$predict(task). I did not find this topic in the mlr3 book. Any hint is very appreciated.

## mlr3 approach
# train/predict
library(mlr3)

data("Sonar", package = "mlbench")
task = TaskClassif$new(id = "Sonar", Sonar, target = "Class", positive = "R")
learner = lrn("classif.rpart", predict_type = "prob")
pred = learner$train(task)$predict(task)

Created on 2021-03-26 by the reprex package (v1.0.0)

ava
  • 840
  • 5
  • 19
  • 1
    Currently, this function is missing in mlr3. I opened an issue in the mlr3viz package https://github.com/mlr-org/mlr3viz/issues/71. – jakob-r Mar 26 '21 at 17:26
  • Thank you. No hurry. I think most user will use `ggplot2` by themselves to draw such a plot. Since I am still new to `mlr3` I just wondered if there was a way to deploy some "old" `mlr` functions in `mlr3`. – ava Mar 26 '21 at 23:56

1 Answers1

0

According to jakob-r's comment, this function is not yet available in mlr3. It might become available in mlr3.

ava
  • 840
  • 5
  • 19