|
14 | 14 | #' significance of the feature's impact on survival. The filter value is
|
15 | 15 | #' `-log10(p)` where `p` is the \eqn{p}-value. This transformation is necessary
|
16 | 16 | #' to ensure numerical stability for very small \eqn{p}-values. Also higher
|
17 |
| -#' values denote more important features. |
| 17 | +#' values denote more important features. The filter works only for numeric |
| 18 | +#' features so please ensure that factor variables are properly encoded, e.g. |
| 19 | +#' using [PipeOpEncode][mlr3pipelines::PipeOpEncode]. |
18 | 20 | #'
|
19 | 21 | #' @family Filter
|
20 | 22 | #' @include Filter.R
|
21 | 23 | #' @template seealso_filter
|
22 | 24 | #' @export
|
23 | 25 | #' @examples
|
24 | 26 | #' if (requireNamespace("mlr3proba")) {
|
25 |
| -#' task = tsk("rats") |
| 27 | +#' task = tsk("rats")$select(c("rx","litter")) |
26 | 28 | #' filter = flt("univariatecox")
|
27 | 29 | #' filter$calculate(task)
|
28 | 30 | #' as.data.table(filter)
|
|
31 | 33 | #' if (mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3proba"), quietly = TRUE)) {
|
32 | 34 | #' library("mlr3pipelines")
|
33 | 35 | #' task = tsk("rats")
|
| 36 | +#' # encode `sex` which is a two-level factor |
| 37 | +#' enc = po("encode", method = "treatment") |
| 38 | +#' task = enc$train(list(task))[[1L]] |
34 | 39 | #'
|
35 | 40 | #' # Note: `filter.cutoff` is selected randomly and should be tuned.
|
36 | 41 | #' # The significance level of `0.05` serves as a conventional threshold.
|
@@ -61,7 +66,7 @@ FilterUnivariateCox = R6Class("FilterUnivariateCox",
|
61 | 66 | id = "surv.univariatecox",
|
62 | 67 | packages = c("mlr3proba"),
|
63 | 68 | param_set = ps(),
|
64 |
| - feature_types = c("integer", "numeric", "factor"), |
| 69 | + feature_types = c("integer", "numeric"), |
65 | 70 | task_types = "surv",
|
66 | 71 | label = "Univariate Cox Survival Score",
|
67 | 72 | man = "mlr3filters::mlr_filters_univariatecox"
|
|
0 commit comments