-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathtest_autoplot.R
50 lines (36 loc) · 1.21 KB
/
test_autoplot.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
skip_if_not_installed("mlr3proba")
require_namespaces("mlr3proba")
task = tsk("rats")
test_that("autoplot.TaskSurv", {
p = autoplot(task, type = "target")
expect_true(is.ggplot(p))
p = autoplot(task, type = "pairs")
expect_s3_class(p, "ggmatrix")
p = autoplot(task, type = "duo")
expect_s3_class(p, "ggmatrix")
})
test_that("autoplot.PredictionSurv", {
learner = suppressWarnings(mlr3::lrn("surv.coxph")$train(task))
prediction = learner$predict(task)
p = autoplot(prediction, type = "calib")
expect_true(is.ggplot(p))
p = autoplot(prediction, type = "dcalib", cuts = 4)
expect_true(is.ggplot(p))
p = suppressWarnings(autoplot(prediction, type = "scalib", time = 95))
expect_true(is.ggplot(p))
p = autoplot(prediction, type = "isd", row_ids = sample(task$row_ids, size = 5))
expect_true(is.ggplot(p))
})
test_that("autoplot.TaskDens", {
skip_if_not_installed("mlr3proba")
require_namespaces("mlr3proba")
task = tsk("precip")
p = autoplot(task, type = "dens")
expect_true(is.ggplot(p))
p = autoplot(task, type = "freq")
expect_true(is.ggplot(p))
p = autoplot(task, type = "overlay")
expect_true(is.ggplot(p))
p = autoplot(task, type = "freqpoly")
expect_true(is.ggplot(p))
})