Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs #132

Closed
wants to merge 14 commits into from
Closed

Docs #132

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ Imports:
Suggests:
care,
caret,
carSurv,
FSelectorRcpp,
knitr,
lgr,
mlr3learners,
mlr3measures,
mlr3proba,
mlr3pipelines,
praznik,
rpart,
testthat (>= 3.0.0),
Expand All @@ -47,15 +46,13 @@ Config/testthat/parallel: true
Encoding: UTF-8
NeedsCompilation: no
Roxygen: list(markdown = TRUE, r6 = TRUE)
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1
Collate:
'Filter.R'
'mlr_filters.R'
'FilterAUC.R'
'FilterAnova.R'
'FilterCMIM.R'
'FilterCarScore.R'
'FilterCarSurvScore.R'
'FilterCorrelation.R'
'FilterDISR.R'
'FilterFindCorrelation.R'
Expand All @@ -75,5 +72,6 @@ Collate:
'bibentries.R'
'flt.R'
'helper.R'
'rd_info.R'
'reexports.R'
'zzz.R'
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

S3method(as.data.table,DictionaryFilter)
S3method(as.data.table,Filter)
S3method(rd_info,Filter)
export(Filter)
export(FilterAUC)
export(FilterAnova)
export(FilterCMIM)
export(FilterCarScore)
export(FilterCarSurvScore)
export(FilterCorrelation)
export(FilterDISR)
export(FilterFindCorrelation)
Expand Down
14 changes: 14 additions & 0 deletions R/FilterAUC.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#'
#' `r format_bib("bommert_2020")`
#'
#' @templateVar id auc
#' @template filter
#' @family Filter
#' @template seealso_filter
#' @export
Expand All @@ -22,6 +24,18 @@
#' filter = flt("auc")
#' filter$calculate(task)
#' head(as.data.table(filter), 3)
#'
#' if (requireNamespace("mlr3pipelines")) {
#' library("mlr3pipelines")
#' task = mlr3::tsk("spam")
#'
#' # Note: The filter.frac is selected randomly and should be tuned.
#'
#' graph = po("filter", filter = flt("auc"), filter.frac = 0.5) %>>%
#' po("learner", mlr3::lrn("classif.rpart"))
#'
#' graph$train(task)
#' }
FilterAUC = R6Class("FilterAUC",
inherit = Filter,

Expand Down
14 changes: 14 additions & 0 deletions R/FilterAnova.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#'
#' `r format_bib("bommert_2020")`
#'
#' @templateVar id anova
#' @template filter
#' @family Filter
#' @importFrom stats aov
#' @template seealso_filter
Expand All @@ -26,6 +28,18 @@
#'
#' # transform to p-value
#' 10^(-filter$scores)
#'
#' if (requireNamespace("mlr3pipelines")) {
#' library("mlr3pipelines")
#' task = mlr3::tsk("spam")
#'
#' # Note: The filter.frac is selected randomly and should be tuned.
#'
#' graph = po("filter", filter = flt("anova"), filter.frac = 0.5) %>>%
#' po("learner", mlr3::lrn("classif.rpart"))
#'
#' graph$train(task)
#' }
FilterAnova = R6Class("FilterAnova",
inherit = Filter,

Expand Down
24 changes: 20 additions & 4 deletions R/FilterCMIM.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,31 @@
#'
#' `r format_bib("bommert_2020")`
#'
#' @templateVar id cmim
#' @template filter
#' @template details_praznik
#' @family Filter
#' @template seealso_filter
#' @export
#' @examples
#' task = mlr3::tsk("iris")
#' filter = flt("cmim")
#' filter$calculate(task, nfeat = 2)
#' as.data.table(filter)
#' if (requireNamespace("praznik")) {
#' task = mlr3::tsk("iris")
#' filter = flt("cmim")
#' filter$calculate(task, nfeat = 2)
#' as.data.table(filter)
#' }
#'
#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) {
#' library("mlr3pipelines")
#' task = mlr3::tsk("spam")
#'
#' # Note: The filter.frac is selected randomly and should be tuned.
#'
#' graph = po("filter", filter = flt("cmim"), filter.frac = 0.5) %>>%
#' po("learner", mlr3::lrn("classif.rpart"))
#'
#' graph$train(task)
#' }
FilterCMIM = R6Class("FilterCMIM",
inherit = Filter,

Expand Down
67 changes: 0 additions & 67 deletions R/FilterCarScore.R

This file was deleted.

9 changes: 2 additions & 7 deletions R/FilterCarSurvScore.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
#' @references
#' `r format_bib("bommert_2021")`
#'
#' @templateVar id surv.carfsurvscore
#' @template filter
#' @family Filter
#' @template seealso_filter
#' @export
#' @examples
#' if (requireNamespace("mlr3proba")) {
#' task = mlr3::tsk("gbcs")
#' filter = flt("carsurvscore")
#' filter$calculate(task)
#' head(as.data.table(filter), 3)
#' }
FilterCarSurvScore = R6Class("FilterCarSurvScore",
inherit = Filter,

Expand Down
13 changes: 13 additions & 0 deletions R/FilterCorrelation.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#'
#' `r format_bib("bommert_2020")`
#'
#' @templateVar id correlation
#' @template filter
#' @family Filter
#' @template seealso_filter
#' @export
Expand All @@ -26,6 +28,17 @@
#' filter$param_set$values = list("method" = "spearman")
#' filter$calculate(task)
#' as.data.table(filter)
#' if (requireNamespace("mlr3pipelines")) {
#' library("mlr3pipelines")
#' task = mlr3::tsk("boston_housing")
#'
#' # Note: The filter.frac is selected randomly and should be tuned.
#'
#' graph = po("filter", filter = flt("correlation"), filter.frac = 0.5) %>>%
#' po("learner", mlr3::lrn("regr.rpart"))
#'
#' graph$train(task)
#' }
FilterCorrelation = R6Class("FilterCorrelation",
inherit = Filter,

Expand Down
24 changes: 20 additions & 4 deletions R/FilterDISR.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,31 @@
#'
#' `r format_bib("bommert_2020")`
#'
#' @templateVar id disr
#' @template filter
#' @template details_praznik
#' @family Filter
#' @template seealso_filter
#' @export
#' @examples
#' task = mlr3::tsk("iris")
#' filter = flt("disr")
#' filter$calculate(task)
#' as.data.table(filter)
#' if (requireNamespace("praznik")) {
#' task = mlr3::tsk("iris")
#' filter = flt("disr")
#' filter$calculate(task)
#' as.data.table(filter)
#' }
#'
#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) {
#' library("mlr3pipelines")
#' task = mlr3::tsk("spam")
#'
#' # Note: The filter.frac is selected randomly and should be tuned.
#'
#' graph = po("filter", filter = flt("disr"), filter.frac = 0.5) %>>%
#' po("learner", mlr3::lrn("classif.rpart"))
#'
#' graph$train(task)
#' }
FilterDISR = R6Class("FilterDISR",
inherit = Filter,

Expand Down
17 changes: 16 additions & 1 deletion R/FilterFindCorrelation.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
#' Subsequently `caret::findCorrelation(cutoff = 0.9)` lists the same features
#' that are excluded with `FilterFindCorrelation` at score 0.1 (= 1 - 0.9).
#'
#' @templateVar id find_correlation
#' @template filter
#'
#' @family Filter
#' @template seealso_filter
#' @export
#' @examples
#' ## Pearson (default)
#' # Pearson (default)
#' task = mlr3::tsk("mtcars")
#' filter = flt("find_correlation")
#' filter$calculate(task)
Expand All @@ -29,6 +32,18 @@
#' filter = flt("find_correlation", method = "spearman")
#' filter$calculate(task)
#' as.data.table(filter)
#'
#' if (requireNamespace("mlr3pipelines")) {
#' library("mlr3pipelines")
#' task = mlr3::tsk("spam")
#'
#' # Note: The filter.frac is selected randomly and should be tuned.
#'
#' graph = po("filter", filter = flt("find_correlation"), filter.frac = 0.5) %>>%
#' po("learner", mlr3::lrn("classif.rpart"))
#'
#' graph$train(task)
#' }
FilterFindCorrelation = R6Class("FilterFindCorrelation",
inherit = Filter,

Expand Down
30 changes: 25 additions & 5 deletions R/FilterImportance.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,35 @@
#' extracting the variable importance (property "importance"), fits the model
#' and extracts the importance values to use as filter scores.
#'
#' @templateVar id importance
#' @template filter
#'
#' @family Filter
#' @template seealso_filter
#' @export
#' @examples
#' task = mlr3::tsk("iris")
#' learner = mlr3::lrn("classif.rpart")
#' filter = flt("importance", learner = learner)
#' filter$calculate(task)
#' as.data.table(filter)
#' if (requireNamespace("MASS")) {
#' task = mlr3::tsk("iris")
#' learner = mlr3::lrn("classif.rpart")
#' filter = flt("importance", learner = learner)
#' filter$calculate(task)
#' as.data.table(filter)
#' }
#'
#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners", "MASS"), quietly = TRUE)) {
#' library("mlr3learners")
#' library("mlr3pipelines")
#' task = mlr3::tsk("spam")
#'
#' learner = mlr3::lrn("classif.rpart")
#'
#' # Note: The filter.frac is selected randomly and should be tuned.
#'
#' graph = po("filter", filter = flt("importance", learner = learner), filter.frac = 0.5) %>>%
#' po("learner", mlr3::lrn("classif.lda"))
#'
#' graph$train(task)
#' }
FilterImportance = R6Class("FilterImportance",
inherit = Filter,

Expand Down
Loading