-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathLearnerSurv.R
50 lines (49 loc) · 1.73 KB
/
LearnerSurv.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
#' @title Survival Learner
#'
#' @description
#' This Learner specializes [Learner] for survival problems:
#'
#' * `task_type` is set to `"surv"`
#' * Creates [Prediction]s of class [PredictionSurv].
#' * Possible values for `predict_types` are:
#' - `"distr"`: Predicts a probability distribution for each observation in the test set,
#' uses [distr6].
#' - `"lp"`: Predicts a linear predictor for each observation in the test set.
#' - `"crank"`: Predicts a continuous ranking for each observation in the test set.
#' - `"response"`: Predicts a survival time for each observation in the test set.
#'
#' @template param_id
#' @template param_param_set
#' @template param_predict_types
#' @template param_feature_types
#' @template param_learner_properties
#' @template param_packages
#' @template param_label
#' @template param_man
#'
#' @family Learner
#' @export
#' @examples
#' library(mlr3)
#' # get all survival learners from mlr_learners:
#' lrns = mlr_learners$mget(mlr_learners$keys("^surv"))
#' names(lrns)
#'
#' # get a specific learner from mlr_learners:
#' mlr_learners$get("surv.coxph")
#' lrn("surv.coxph")
LearnerSurv = R6Class("LearnerSurv",
inherit = Learner,
public = list(
#' @description Creates a new instance of this [R6][R6::R6Class] class.
initialize = function(id, param_set = ps(), predict_types = "distr",
feature_types = character(), properties = character(),
packages = character(), label = NA_character_, man = NA_character_) {
super$initialize(
id = id, task_type = "surv", param_set = param_set, predict_types = predict_types,
feature_types = feature_types, properties = properties,
packages = c("mlr3proba", packages), label = label, man = man
)
}
)
)