Skip to content

Commit

Permalink
remove example due to mlr3proba not being in CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
bblodfon committed Nov 3, 2023
1 parent a86f687 commit c35afa1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 74 deletions.
39 changes: 2 additions & 37 deletions R/FilterUnivariateCox.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,10 @@
#' @template seealso_filter
#' @export
#' @examples
#' if (mlr3misc::require_namespaces(c("mlr3", "mlr3proba", "mlr3pipelines"), quietly = TRUE)) {
#' library(mlr3)
#' library(mlr3proba)
#' library(mlr3pipelines)
#'
#' # encode `sex` (two-level factor)
#' task = tsk("rats")
#' enc = po("encode", method = "treatment")
#' task = enc$train(list(task))[[1L]]
#' filter = flt("univariate_cox")
#' filter
#'
#' # simple filter use
#' filter = flt("univariate_cox")
#' filter$calculate(task)
#' as.data.table(filter)
#'
#' # transform to p-value
#' 10^(-filter$scores)
#'
#' # Use filter in a learner pipeline
#' # Note: `filter.cutoff` is selected randomly and should be tuned.
#' # The significance level of `0.05` serves as a conventional threshold.
#' # The filter returns the `-log10`-transformed scores so we transform
#' # the cutoff as well:
#' cutoff = -log10(0.05) # ~1.3
#'
#' graph =
#' po("filter", filter = flt("univariate_cox"), filter.cutoff = cutoff) %>>%
#' po("learner", lrn("surv.coxph"))
#' learner = as_learner(graph)
#'
#' learner$train(task)
#'
#' # univariate cox filter scores
#' learner$model$surv.univariate_cox$scores
#'
#' # only two features had a score larger than the specified `cutoff` and
#' # were used to train the CoxPH model
#' learner$model$surv.coxph$train_task$feature_names
#' }
FilterUnivariateCox = R6Class("FilterUnivariateCox",
inherit = Filter,
public = list(
Expand Down
39 changes: 2 additions & 37 deletions man/mlr_filters_univariate_cox.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c35afa1

Please sign in to comment.