Skip to content

Commit c35afa1

Browse files
committed
remove example due to mlr3proba not being in CRAN
1 parent a86f687 commit c35afa1

File tree

2 files changed

+4
-74
lines changed

2 files changed

+4
-74
lines changed

R/FilterUnivariateCox.R

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,10 @@
2323
#' @template seealso_filter
2424
#' @export
2525
#' @examples
26-
#' if (mlr3misc::require_namespaces(c("mlr3", "mlr3proba", "mlr3pipelines"), quietly = TRUE)) {
27-
#' library(mlr3)
28-
#' library(mlr3proba)
29-
#' library(mlr3pipelines)
3026
#'
31-
#' # encode `sex` (two-level factor)
32-
#' task = tsk("rats")
33-
#' enc = po("encode", method = "treatment")
34-
#' task = enc$train(list(task))[[1L]]
27+
#' filter = flt("univariate_cox")
28+
#' filter
3529
#'
36-
#' # simple filter use
37-
#' filter = flt("univariate_cox")
38-
#' filter$calculate(task)
39-
#' as.data.table(filter)
40-
#'
41-
#' # transform to p-value
42-
#' 10^(-filter$scores)
43-
#'
44-
#' # Use filter in a learner pipeline
45-
#' # Note: `filter.cutoff` is selected randomly and should be tuned.
46-
#' # The significance level of `0.05` serves as a conventional threshold.
47-
#' # The filter returns the `-log10`-transformed scores so we transform
48-
#' # the cutoff as well:
49-
#' cutoff = -log10(0.05) # ~1.3
50-
#'
51-
#' graph =
52-
#' po("filter", filter = flt("univariate_cox"), filter.cutoff = cutoff) %>>%
53-
#' po("learner", lrn("surv.coxph"))
54-
#' learner = as_learner(graph)
55-
#'
56-
#' learner$train(task)
57-
#'
58-
#' # univariate cox filter scores
59-
#' learner$model$surv.univariate_cox$scores
60-
#'
61-
#' # only two features had a score larger than the specified `cutoff` and
62-
#' # were used to train the CoxPH model
63-
#' learner$model$surv.coxph$train_task$feature_names
64-
#' }
6530
FilterUnivariateCox = R6Class("FilterUnivariateCox",
6631
inherit = Filter,
6732
public = list(

man/mlr_filters_univariate_cox.Rd

Lines changed: 2 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)