tests/testthat/test_PredictionSurv.R

test_that("autoplot.PredictionSurv", {
  skip_if_not_installed("mlr3proba")
  require_namespaces("mlr3proba")

  task = mlr3::tsk("rats")$filter(1:100)
  learner = mlr3::lrn("surv.kaplan")$train(task)
  prediction = learner$predict(task)

  p = autoplot(prediction, type = "calib", task = task)
  expect_true(is.ggplot(p))
  vdiffr::expect_doppelganger("predictionsurv_calib", p)

  p = autoplot(prediction, type = "dcalib")
  expect_true(is.ggplot(p))
  vdiffr::expect_doppelganger("predictionsurv_dcalib", p)
})
mlr-org/mlr3viz documentation built on Oct. 19, 2021, 1:10 p.m.