Skip to content

Commit 98798a8

Browse files
committed
fix example
1 parent bf80a0b commit 98798a8

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

R/FilterUnivariateCox.R

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,25 @@
2323
#' @template seealso_filter
2424
#' @export
2525
#' @examples
26-
#' if (requireNamespace("mlr3proba")) {
27-
#' task = tsk("rats")$select(c("rx","litter"))
28-
#' filter = flt("univariatecox")
29-
#' filter$calculate(task)
30-
#' as.data.table(filter)
31-
#' }
26+
#' if (mlr3misc::require_namespaces(c("mlr3", "mlr3proba", "mlr3pipelines"), quietly = TRUE)) {
27+
#' library(mlr3)
28+
#' library(mlr3proba)
29+
#' library(mlr3pipelines)
3230
#'
33-
#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3proba"), quietly = TRUE)) {
34-
#' library("mlr3pipelines")
31+
#' # encode `sex` (two-level factor)
3532
#' task = tsk("rats")
36-
#' # encode `sex` which is a two-level factor
3733
#' enc = po("encode", method = "treatment")
3834
#' task = enc$train(list(task))[[1L]]
3935
#'
36+
#' # simple filter use
37+
#' filter = flt("univariatecox")
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
4045
#' # Note: `filter.cutoff` is selected randomly and should be tuned.
4146
#' # The significance level of `0.05` serves as a conventional threshold.
4247
#' # The filter returns the `-log`-transformed scores so we transform

man/mlr_filters_univariatecox.Rd

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

0 commit comments

Comments
 (0)