tests/testthat/test_LearnerClassif.R

test_that("autoplot.PredictionClassif decision boundary probability", {
  set.seed(42)
  task = mlr3::tsk("pima")$select(c("age", "pedigree"))
  learner = mlr3::lrn("classif.rpart", predict_type = "prob")$train(task)

  p = autoplot(learner, type = "prediction", task = task)
  expect_true(is.ggplot(p))
  expect_doppelganger("learner_classif_prob", p)
})

test_that("autoplot.PredictionClassif decision boundary response", {
  set.seed(42)
  task = mlr3::tsk("pima")$select(c("age", "pedigree"))
  learner = mlr3::lrn("classif.rpart")$train(task)

  p = autoplot(learner, type = "prediction", task = task)
  expect_true(is.ggplot(p))
  expect_doppelganger("learner_classif_response", p)
})

Try the mlr3viz package in your browser

Any scripts or data that you put into this service are public.

mlr3viz documentation built on July 1, 2024, 5:06 p.m.