# NOT RUN {
if (requireNamespace("ggplot2", quietly = TRUE)) {
#' library(mlr3)
task = tsk("rats")
# Prediction Error Curves for prediction object
learn = lrn("surv.coxph")
p = learn$train(task)$predict(task)
pecs(p)
pecs(p, measure = "logloss", times = c(20, 40, 60, 80)) +
ggplot2::geom_point() +
ggplot2::ggtitle("Logloss Prediction Error Curve for Cox PH")
# Access underlying data
x = pecs(p)
x$data
# Prediction Error Curves for fitted learners
learns = lrns(c("surv.kaplan", "surv.coxph"))
lapply(learns, function(x) x$train(task))
pecs(learns, task = task, measure = "logloss", times = c(20, 90), n = 10)
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab