From 4205296a2009c630120b3afcca4db256ddd926cf Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 8 Aug 2022 12:03:20 +0200 Subject: [PATCH 01/11] fix: remove mlr3proba --- DESCRIPTION | 5 +- R/FilterCarSurvScore.R | 63 ------------------- man/mlr_filters_carsurvscore.Rd | 101 ------------------------------ tests/testthat/test_filter_surv.R | 17 ----- 4 files changed, 2 insertions(+), 184 deletions(-) delete mode 100644 R/FilterCarSurvScore.R delete mode 100644 man/mlr_filters_carsurvscore.Rd delete mode 100644 tests/testthat/test_filter_surv.R diff --git a/DESCRIPTION b/DESCRIPTION index 6a563ad7..8524a0ec 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,7 +37,7 @@ Suggests: lgr, mlr3learners, mlr3measures, - mlr3proba, + mlr3pipelines, praznik, rpart, testthat (>= 3.0.0), @@ -47,7 +47,7 @@ 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' @@ -55,7 +55,6 @@ Collate: 'FilterAnova.R' 'FilterCMIM.R' 'FilterCarScore.R' - 'FilterCarSurvScore.R' 'FilterCorrelation.R' 'FilterDISR.R' 'FilterFindCorrelation.R' diff --git a/R/FilterCarSurvScore.R b/R/FilterCarSurvScore.R deleted file mode 100644 index e634f6f7..00000000 --- a/R/FilterCarSurvScore.R +++ /dev/null @@ -1,63 +0,0 @@ -#' @title Correlation-Adjusted Survival Score Filter -#' -#' @name mlr_filters_carsurvscore -#' -#' @description Calculates CARS scores for right-censored survival tasks. -#' Calls the implementation in [carSurv::carSurvScore()] in package -#' \CRANpkg{carSurv}. -#' -#' @references -#' `r format_bib("bommert_2021")` -#' -#' @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, - - public = list( - #' @description Create a FilterCarSurvScore object. - initialize = function() { - ps = ps( - maxIPCweight = p_int(lower = 0, default = 10), - denom = p_fct(c("1/n", "sum_w"), default = "1/n") - ) - super$initialize( - id = "surv.carsurvscore", - packages = c("carSurv", "mlr3proba"), - param_set = ps, - feature_types = c("integer", "numeric"), - task_type = "surv", - label = "Correlation-Adjusted coRrelation Survival Score", - man = "mlr3filters::mlr_filters_carsurvscore" - ) - } - ), - - private = list( - .calculate = function(task, nfeat) { - pv = self$param_set$values - - surv = task$truth() - X = as.matrix(task$data(cols = task$feature_names)) - scores = invoke(carSurv::carSurvScore, - obsTime = surv[, 1L], - obsEvent = surv[, 2L], - X = X, - .args = pv - ) - - set_names(abs(scores), colnames(X)) - } - ) -) - -#' @include mlr_filters.R -mlr_filters$add("carsurvscore", FilterCarSurvScore) diff --git a/man/mlr_filters_carsurvscore.Rd b/man/mlr_filters_carsurvscore.Rd deleted file mode 100644 index a1e4ffeb..00000000 --- a/man/mlr_filters_carsurvscore.Rd +++ /dev/null @@ -1,101 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FilterCarSurvScore.R -\name{mlr_filters_carsurvscore} -\alias{mlr_filters_carsurvscore} -\alias{FilterCarSurvScore} -\title{Correlation-Adjusted Survival Score Filter} -\description{ -Calculates CARS scores for right-censored survival tasks. -Calls the implementation in \code{\link[carSurv:carSurvScore]{carSurv::carSurvScore()}} in package -\CRANpkg{carSurv}. -} -\examples{ -if (requireNamespace("mlr3proba")) { - task = mlr3::tsk("gbcs") - filter = flt("carsurvscore") - filter$calculate(task) - head(as.data.table(filter), 3) -} -} -\references{ -Bommert A, Welchowski T, Schmid M, Rahnenführer J (2021). -\dQuote{Benchmark of filter methods for feature selection in high-dimensional gene expression survival data.} -\emph{Briefings in Bioinformatics}, \bold{23}(1). -\doi{0.1093/bib/bbab354}. -} -\seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} - -Other Filter: -\code{\link{Filter}}, -\code{\link{mlr_filters_anova}}, -\code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_cmim}}, -\code{\link{mlr_filters_correlation}}, -\code{\link{mlr_filters_disr}}, -\code{\link{mlr_filters_find_correlation}}, -\code{\link{mlr_filters_importance}}, -\code{\link{mlr_filters_information_gain}}, -\code{\link{mlr_filters_jmim}}, -\code{\link{mlr_filters_jmi}}, -\code{\link{mlr_filters_kruskal_test}}, -\code{\link{mlr_filters_mim}}, -\code{\link{mlr_filters_mrmr}}, -\code{\link{mlr_filters_njmim}}, -\code{\link{mlr_filters_performance}}, -\code{\link{mlr_filters_permutation}}, -\code{\link{mlr_filters_relief}}, -\code{\link{mlr_filters_selected_features}}, -\code{\link{mlr_filters_variance}}, -\code{\link{mlr_filters}} -} -\concept{Filter} -\section{Super class}{ -\code{\link[mlr3filters:Filter]{mlr3filters::Filter}} -> \code{FilterCarSurvScore} -} -\section{Methods}{ -\subsection{Public methods}{ -\itemize{ -\item \href{#method-FilterCarSurvScore-new}{\code{FilterCarSurvScore$new()}} -\item \href{#method-FilterCarSurvScore-clone}{\code{FilterCarSurvScore$clone()}} -} -} -\if{html}{\out{ -
Inherited methods - -
-}} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-FilterCarSurvScore-new}{}}} -\subsection{Method \code{new()}}{ -Create a FilterCarSurvScore object. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{FilterCarSurvScore$new()}\if{html}{\out{
}} -} - -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-FilterCarSurvScore-clone}{}}} -\subsection{Method \code{clone()}}{ -The objects of this class are cloneable with this method. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{FilterCarSurvScore$clone(deep = FALSE)}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{deep}}{Whether to make a deep clone.} -} -\if{html}{\out{
}} -} -} -} diff --git a/tests/testthat/test_filter_surv.R b/tests/testthat/test_filter_surv.R deleted file mode 100644 index 74570f99..00000000 --- a/tests/testthat/test_filter_surv.R +++ /dev/null @@ -1,17 +0,0 @@ -skip_if_not_installed("mlr3proba") - -test_that("mlr3proba learners work", { - requireNamespace("mlr3proba") - - # needs to be fixed in mlr3proba - withr::local_options(warnPartialMatchDollar = FALSE, warnPartialMatchArgs = FALSE, warnPartialMatchAttr = FALSE) - - task = tsk("rats") - learner = lrn("surv.rpart") - resampling = rsmp("holdout") - - f = flt("performance", learner = learner, resampling = resampling) - f$calculate(task) - - expect_filter(f, task = task) -}) From 5cb003930d8eba5c61d95bb274e03976f79a5f40 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 8 Aug 2022 12:08:13 +0200 Subject: [PATCH 02/11] docs: add docu for PipeOpFilter --- NAMESPACE | 1 - R/FilterAUC.R | 10 ++++ R/FilterAnova.R | 10 ++++ R/FilterCMIM.R | 20 +++++-- R/FilterCarScore.R | 20 +++++-- R/FilterCorrelation.R | 9 +++ R/FilterDISR.R | 20 +++++-- R/FilterFindCorrelation.R | 11 +++- R/FilterImportance.R | 13 ++++ R/FilterInformationGain.R | 36 +++++++---- R/FilterJMI.R | 20 +++++-- R/FilterJMIM.R | 21 +++++-- R/FilterKruskalTest.R | 10 ++++ R/FilterMIM.R | 22 +++++-- R/FilterMRMR.R | 20 +++++-- R/FilterNJMIM.R | 20 +++++-- R/FilterPerformance.R | 9 +++ R/FilterPermutation.R | 18 ++++++ R/FilterRelief.R | 24 ++++++-- R/FilterSelectedFeatures.R | 2 + R/FilterVariance.R | 10 ++++ README.Rmd | 23 +++++++ README.md | 89 ++++++++++++++++++---------- man-roxygen/seealso_filter.R | 3 +- man/Filter.Rd | 1 - man/mlr_filters.Rd | 1 - man/mlr_filters_anova.Rd | 24 ++++++-- man/mlr_filters_auc.Rd | 24 ++++++-- man/mlr_filters_carscore.Rd | 34 +++++++---- man/mlr_filters_cmim.Rd | 34 +++++++---- man/mlr_filters_correlation.Rd | 23 +++++-- man/mlr_filters_disr.Rd | 34 +++++++---- man/mlr_filters_find_correlation.Rd | 24 +++++--- man/mlr_filters_importance.Rd | 27 +++++++-- man/mlr_filters_information_gain.Rd | 50 ++++++++++------ man/mlr_filters_jmi.Rd | 34 +++++++---- man/mlr_filters_jmim.Rd | 35 +++++++---- man/mlr_filters_kruskal_test.Rd | 24 ++++++-- man/mlr_filters_mim.Rd | 36 +++++++---- man/mlr_filters_mrmr.Rd | 34 +++++++---- man/mlr_filters_njmim.Rd | 34 +++++++---- man/mlr_filters_performance.Rd | 23 +++++-- man/mlr_filters_permutation.Rd | 33 +++++++++-- man/mlr_filters_relief.Rd | 38 ++++++++---- man/mlr_filters_selected_features.Rd | 22 +++++-- man/mlr_filters_variance.Rd | 24 ++++++-- 46 files changed, 799 insertions(+), 255 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index a2f9dd63..b5c97f0b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,7 +7,6 @@ export(FilterAUC) export(FilterAnova) export(FilterCMIM) export(FilterCarScore) -export(FilterCarSurvScore) export(FilterCorrelation) export(FilterDISR) export(FilterFindCorrelation) diff --git a/R/FilterAUC.R b/R/FilterAUC.R index e5dbb3dd..dfa4b787 100644 --- a/R/FilterAUC.R +++ b/R/FilterAUC.R @@ -22,6 +22,16 @@ #' filter = flt("auc") #' filter$calculate(task) #' head(as.data.table(filter), 3) +#' +#' if (requireNamespace("mlr3pipelines")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("auc"), filter.cutoff = 0.1) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterAUC = R6Class("FilterAUC", inherit = Filter, diff --git a/R/FilterAnova.R b/R/FilterAnova.R index 330ec50d..ab328c0e 100644 --- a/R/FilterAnova.R +++ b/R/FilterAnova.R @@ -26,6 +26,16 @@ #' #' # transform to p-value #' 10^(-filter$scores) +#' +#' if (requireNamespace("mlr3pipelines")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("anova"), filter.cutoff = 20) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterAnova = R6Class("FilterAnova", inherit = Filter, diff --git a/R/FilterCMIM.R b/R/FilterCMIM.R index 297146ed..85beee61 100644 --- a/R/FilterCMIM.R +++ b/R/FilterCMIM.R @@ -19,10 +19,22 @@ #' @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 (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("cmim"), filter.cutoff = 0.5) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterCMIM = R6Class("FilterCMIM", inherit = Filter, diff --git a/R/FilterCarScore.R b/R/FilterCarScore.R index 7db6555d..9a8645d1 100644 --- a/R/FilterCarScore.R +++ b/R/FilterCarScore.R @@ -14,16 +14,28 @@ #' @template seealso_filter #' @export #' @examples -#' task = mlr3::tsk("mtcars") -#' filter = flt("carscore") -#' filter$calculate(task) -#' head(as.data.table(filter), 3) +#' if (requireNamespace("care")) { +#' task = mlr3::tsk("mtcars") +#' filter = flt("carscore") +#' filter$calculate(task) +#' head(as.data.table(filter), 3) +#' } #' #' ## changing filter settings #' filter = flt("carscore") #' filter$param_set$values = list("diagonal" = TRUE) #' filter$calculate(task) #' head(as.data.table(filter), 3) +#' +#' if (requireNamespace("mlr3pipelines") && requireNamespace("care")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("mtcars") +#' +#' graph = po("filter", filter = flt("carscore"), filter.cutoff = 0.2) %>>% +#' po("learner", mlr3::lrn("regr.rpart")) +#' +#' graph$train(task) +#' } FilterCarScore = R6Class("FilterCarScore", inherit = Filter, diff --git a/R/FilterCorrelation.R b/R/FilterCorrelation.R index 6ac34448..9c021735 100644 --- a/R/FilterCorrelation.R +++ b/R/FilterCorrelation.R @@ -26,6 +26,15 @@ #' filter$param_set$values = list("method" = "spearman") #' filter$calculate(task) #' as.data.table(filter) +#' if (requireNamespace("mlr3pipelines")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("boston_housing") +#' +#' graph = po("filter", filter = flt("correlation"), filter.cutoff = 0.2) %>>% +#' po("learner", mlr3::lrn("regr.rpart")) +#' +#' graph$train(task) +#' } FilterCorrelation = R6Class("FilterCorrelation", inherit = Filter, diff --git a/R/FilterDISR.R b/R/FilterDISR.R index d1533044..54f24424 100644 --- a/R/FilterDISR.R +++ b/R/FilterDISR.R @@ -19,10 +19,22 @@ #' @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 (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("disr"), filter.cutoff = 0.2) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterDISR = R6Class("FilterDISR", inherit = Filter, diff --git a/R/FilterFindCorrelation.R b/R/FilterFindCorrelation.R index 39c47d73..919e0450 100644 --- a/R/FilterFindCorrelation.R +++ b/R/FilterFindCorrelation.R @@ -19,7 +19,7 @@ #' @template seealso_filter #' @export #' @examples -#' ## Pearson (default) +## Pearson (default) #' task = mlr3::tsk("mtcars") #' filter = flt("find_correlation") #' filter$calculate(task) @@ -29,6 +29,15 @@ #' filter = flt("find_correlation", method = "spearman") #' filter$calculate(task) #' as.data.table(filter) +#' +#' if (requireNamespace("mlr3pipelines")) { +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("find_correlation"), filter.cutoff = 0.4) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterFindCorrelation = R6Class("FilterFindCorrelation", inherit = Filter, diff --git a/R/FilterImportance.R b/R/FilterImportance.R index 90d5cb57..d1644e92 100644 --- a/R/FilterImportance.R +++ b/R/FilterImportance.R @@ -16,6 +16,19 @@ #' filter = flt("importance", learner = learner) #' filter$calculate(task) #' as.data.table(filter) +#' +#' if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && requireNamespace("MASS")) { +#' library("mlr3learners") +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' learner = mlr3::lrn("classif.rpart") +#' +#' graph = po("filter", filter = flt("importance", learner = learner), filter.cutoff = 100) %>>% +#' po("learner", mlr3::lrn("classif.lda")) +#' +#' graph$train(task) +#' } FilterImportance = R6Class("FilterImportance", inherit = Filter, diff --git a/R/FilterInformationGain.R b/R/FilterInformationGain.R index 748c63c8..b39cb1d8 100644 --- a/R/FilterInformationGain.R +++ b/R/FilterInformationGain.R @@ -15,19 +15,33 @@ #' @template seealso_filter #' @export #' @examples -#' ## InfoGain (default) -#' task = mlr3::tsk("pima") -#' filter = flt("information_gain") -#' filter$calculate(task) -#' head(filter$scores, 3) -#' as.data.table(filter) +#' if (requireNamespace("FSelectorRcpp")) { +#' ## InfoGain (default) +#' task = mlr3::tsk("pima") +#' filter = flt("information_gain") +#' filter$calculate(task) +#' head(filter$scores, 3) +#' as.data.table(filter) #' -#' ## GainRatio +#' ## GainRatio #' -#' filterGR = flt("information_gain") -#' filterGR$param_set$values = list("type" = "gainratio") -#' filterGR$calculate(task) -#' head(as.data.table(filterGR), 3) +#' filterGR = flt("information_gain") +#' filterGR$param_set$values = list("type" = "gainratio") +#' filterGR$calculate(task) +#' head(as.data.table(filterGR), 3) +#' +#' } +#' +#' if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("information_gain"), filter.cutoff = 0.1) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' +#' } FilterInformationGain = R6Class("FilterInformationGain", inherit = Filter, diff --git a/R/FilterJMI.R b/R/FilterJMI.R index f3579e4e..d0d18bdc 100644 --- a/R/FilterJMI.R +++ b/R/FilterJMI.R @@ -20,10 +20,22 @@ #' @template seealso_filter #' @export #' @examples -#' task = mlr3::tsk("iris") -#' filter = flt("jmi") -#' filter$calculate(task, nfeat = 2) -#' as.data.table(filter) +#' if (requireNamespace("praznik")) { +#' task = mlr3::tsk("iris") +#' filter = flt("jmi") +#' filter$calculate(task, nfeat = 2) +#' as.data.table(filter) +#' } +#' +#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("jmi"), filter.cutoff = 0.2) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterJMI = R6Class("FilterJMI", inherit = Filter, diff --git a/R/FilterJMIM.R b/R/FilterJMIM.R index b93e5327..94d4a22d 100644 --- a/R/FilterJMIM.R +++ b/R/FilterJMIM.R @@ -19,10 +19,23 @@ #' @template seealso_filter #' @export #' @examples -#' task = mlr3::tsk("iris") -#' filter = flt("jmim") -#' filter$calculate(task, nfeat = 2) -#' as.data.table(filter) +#' if (requireNamespace("praznik")) { +#' task = mlr3::tsk("iris") +#' filter = flt("jmim") +#' filter$calculate(task, nfeat = 2) +#' as.data.table(filter) +#' } +#' +#' +#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("jmim"), filter.cutoff = 0.5) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterJMIM = R6Class("FilterJMIM", inherit = Filter, diff --git a/R/FilterKruskalTest.R b/R/FilterKruskalTest.R index 06ddbd1d..63daf2d1 100644 --- a/R/FilterKruskalTest.R +++ b/R/FilterKruskalTest.R @@ -25,6 +25,16 @@ #' #' # transform to p-value #' 10^(-filter$scores) +#' +#' if (requireNamespace("mlr3pipelines")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("kruskal_test"), filter.cutoff = 0.2) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterKruskalTest = R6Class("FilterKruskalTest", inherit = Filter, diff --git a/R/FilterMIM.R b/R/FilterMIM.R index 9a94dbda..68742ebc 100644 --- a/R/FilterMIM.R +++ b/R/FilterMIM.R @@ -19,10 +19,24 @@ #' @template seealso_filter #' @export #' @examples -#' task = mlr3::tsk("iris") -#' filter = flt("mim") -#' filter$calculate(task, nfeat = 2) -#' as.data.table(filter) +#' +#' if (requireNamespace("praznik")) { +#' task = mlr3::tsk("iris") +#' filter = flt("mim") +#' filter$calculate(task, nfeat = 2) +#' as.data.table(filter) +#' } +#' +#' +#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("mim"), filter.cutoff = 0.3) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterMIM = R6Class("FilterMIM", inherit = Filter, diff --git a/R/FilterMRMR.R b/R/FilterMRMR.R index f359b02d..24e68539 100644 --- a/R/FilterMRMR.R +++ b/R/FilterMRMR.R @@ -19,10 +19,22 @@ #' @template seealso_filter #' @export #' @examples -#' task = mlr3::tsk("iris") -#' filter = flt("mrmr") -#' filter$calculate(task, nfeat = 2) -#' as.data.table(filter) +#' if (requireNamespace("praznik")) { +#' task = mlr3::tsk("iris") +#' filter = flt("mrmr") +#' filter$calculate(task, nfeat = 2) +#' as.data.table(filter) +#' } +#' +#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("mrmr"), filter.cutoff = 0.4) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterMRMR = R6Class("FilterMRMR", inherit = Filter, diff --git a/R/FilterNJMIM.R b/R/FilterNJMIM.R index e48fe575..34a8e38a 100644 --- a/R/FilterNJMIM.R +++ b/R/FilterNJMIM.R @@ -19,10 +19,22 @@ #' @template seealso_filter #' @export #' @examples -#' task = mlr3::tsk("iris") -#' filter = flt("njmim") -#' filter$calculate(task, nfeat = 2) -#' as.data.table(filter) +#' if (requireNamespace("praznik")) { +#' task = mlr3::tsk("iris") +#' filter = flt("njmim") +#' filter$calculate(task, nfeat = 2) +#' as.data.table(filter) +#' } +#' +#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("njmim"), filter.cutoff = 0.4) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterNJMIM = R6Class("FilterNJMIM", inherit = Filter, diff --git a/R/FilterPerformance.R b/R/FilterPerformance.R index 4cb8d21d..05866271 100644 --- a/R/FilterPerformance.R +++ b/R/FilterPerformance.R @@ -17,6 +17,15 @@ #' filter = flt("performance", learner = learner) #' filter$calculate(task) #' as.data.table(filter) +#' if (requireNamespace("mlr3pipelines")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("performance", learner = lrn("classif.rpart")), filter.cutoff = -0.3) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterPerformance = R6Class("FilterPerformance", inherit = Filter, diff --git a/R/FilterPermutation.R b/R/FilterPermutation.R index fcb33fa1..2092ef8b 100644 --- a/R/FilterPermutation.R +++ b/R/FilterPermutation.R @@ -21,6 +21,24 @@ #' @family Filter #' @template seealso_filter #' @export +#' @examples +#' learner = mlr3::lrn("classif.rpart") +#' resampling = mlr3::rsmp("holdout") +#' measure = mlr3::msr("classif.acc") +#' filter = flt("permutation", learner = learner, measure = measure, resampling = resampling, nmc = 2) +#' task = mlr3::tsk("iris") +#' filter$calculate(task) +#' as.data.table(filter) +#' +#' if (requireNamespace("mlr3pipelines")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("iris") +#' +#' graph = po("filter", filter = flt("permutation", nmc = 2), filter.cutoff = 0.1) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterPermutation = R6Class("FilterPermutation", inherit = Filter, public = list( diff --git a/R/FilterRelief.R b/R/FilterRelief.R index 94cc51f6..569e9fd2 100644 --- a/R/FilterRelief.R +++ b/R/FilterRelief.R @@ -9,12 +9,24 @@ #' @template seealso_filter #' @export #' @examples -#' ## Relief (default) -#' task = mlr3::tsk("pima") -#' filter = flt("relief") -#' filter$calculate(task) -#' head(filter$scores, 3) -#' as.data.table(filter) +#' if (requireNamespace("FSelectorRcpp")) { +#' ## Relief (default) +#' task = mlr3::tsk("pima") +#' filter = flt("relief") +#' filter$calculate(task) +#' head(filter$scores, 3) +#' as.data.table(filter) +#' } +#' +#' if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("iris") +#' +#' graph = po("filter", filter = flt("relief"), filter.cutoff = 0.15) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterRelief = R6Class("FilterRelief", inherit = Filter, diff --git a/R/FilterSelectedFeatures.R b/R/FilterSelectedFeatures.R index 0423e0c8..f8ea66fa 100644 --- a/R/FilterSelectedFeatures.R +++ b/R/FilterSelectedFeatures.R @@ -35,6 +35,8 @@ FilterSelectedFeatures = R6Class("FilterSelectedFeatures", #' @description Create a FilterImportance object. #' Learner to extract the selected features from. + #' @param learner (`Learner`)\cr + #' Learner with property `"selected_features"`. initialize = function(learner = mlr3::lrn("classif.featureless")) { self$learner = learner = assert_learner(as_learner(learner, clone = TRUE), properties = "selected_features") diff --git a/R/FilterVariance.R b/R/FilterVariance.R index 15352a4d..8fccb335 100644 --- a/R/FilterVariance.R +++ b/R/FilterVariance.R @@ -21,6 +21,16 @@ #' filter$calculate(task) #' head(filter$scores, 3) #' as.data.table(filter) +#' +#' if (requireNamespace("mlr3pipelines")) { +#' library("mlr3pipelines") +#' task = mlr3::tsk("spam") +#' +#' graph = po("filter", filter = flt("variance"), filter.cutoff = 1) %>>% +#' po("learner", mlr3::lrn("classif.rpart")) +#' +#' graph$train(task) +#' } FilterVariance = R6Class("FilterVariance", inherit = Filter, diff --git a/README.Rmd b/README.Rmd index 03a4f1c2..deae3065 100644 --- a/README.Rmd +++ b/README.Rmd @@ -114,3 +114,26 @@ head(as.data.table(filter), 3) `FilterPerformance` is a univariate filter method which calls `resample()` with every predictor variable in the dataset and ranks the final outcome using the supplied measure. Any learner can be passed to this filter with `classif.rpart` being the default. Of course, also regression learners can be passed if the task is of type "regr". + +### Filtering in a Pipeline + +In many cases filtering is only one step in the modeling pipeline. +To select features based on filter values, one can use [`PipeOpFilter`](https://mlr3pipelines.mlr-org.com/reference/mlr_pipeops_filter.html) from +[mlr3pipelines](https://github.com/mlr-org/mlr3pipelines) to e.g. select features before +training a learner. + +```{r} +library(mlr3pipelines) + +task = tsk("spam") + +graph = po("filter", filter = flt("auc"), filter.cutoff = 0.1) %>>% + po("learner", lrn("classif.rpart")) + +learner = as_learner(graph) + +rr = resample(task, learner, rsmp("holdout")) +``` + + + diff --git a/README.md b/README.md index 259203fb..65b0412a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # mlr3filters -Package website: [release](https://mlr3filters.mlr-org.com/) \| +Package website: [release](https://mlr3filters.mlr-org.com/) | [dev](https://mlr3filters.mlr-org.com/dev/) {mlr3filters} adds feature selection filters to @@ -54,6 +54,7 @@ as.data.table(filter$calculate(task)) ``` ## feature score + ## ## 1: glucose 0.2927906 ## 2: insulin 0.2316288 ## 3: mass 0.1870358 @@ -65,38 +66,40 @@ as.data.table(filter$calculate(task)) ### Implemented Filters -| Name | Task Type | Feature Types | Package | -|:------------------|:---------------|:-------------------------------------------|:------------------------------------------------------------------| -| anova | Classif | Integer, Numeric | stats | -| auc | Classif | Integer, Numeric | [mlr3measures](https://cran.r-project.org/package=mlr3measures) | -| carscore | Regr | Numeric | [care](https://cran.r-project.org/package=care) | -| cmim | Classif & Regr | Integer, Numeric, Factor, Ordered | [praznik](https://cran.r-project.org/package=praznik) | -| correlation | Regr | Integer, Numeric | stats | -| disr | Classif & Regr | Integer, Numeric, Factor, Ordered | [praznik](https://cran.r-project.org/package=praznik) | -| find_correlation | Classif & Regr | Integer, Numeric | stats | -| importance | Universal | Logical, Integer, Numeric, Factor, Ordered | | -| information_gain | Classif & Regr | Integer, Numeric, Factor, Ordered | [FSelectorRcpp](https://cran.r-project.org/package=FSelectorRcpp) | -| jmi | Classif & Regr | Integer, Numeric, Factor, Ordered | [praznik](https://cran.r-project.org/package=praznik) | -| jmim | Classif & Regr | Integer, Numeric, Factor, Ordered | [praznik](https://cran.r-project.org/package=praznik) | -| kruskal_test | Classif | Integer, Numeric | stats | -| mim | Classif & Regr | Integer, Numeric, Factor, Ordered | [praznik](https://cran.r-project.org/package=praznik) | -| mrmr | Classif & Regr | Integer, Numeric, Factor, Ordered | [praznik](https://cran.r-project.org/package=praznik) | -| njmim | Classif & Regr | Integer, Numeric, Factor, Ordered | [praznik](https://cran.r-project.org/package=praznik) | -| performance | Universal | Logical, Integer, Numeric, Factor, Ordered | | -| permutation | Universal | Logical, Integer, Numeric, Factor, Ordered | | -| relief | Classif & Regr | Integer, Numeric, Factor, Ordered | [FSelectorRcpp](https://cran.r-project.org/package=FSelectorRcpp) | -| selected_features | Classif | Logical, Integer, Numeric, Factor, Ordered | | -| variance | Classif & Regr | Integer, Numeric | stats | + ## Warning in `[.data.table`(as.data.table(mlr_filters), , !c("param_set", : + ## column(s) not removed because not found: [param_set] + +| Name | label | Task Type | params | Feature Types | Package | +| :----------------- | :------------------------------------------------------- | :------------- | :----------------------------------- | :------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | +| anova | ANOVA F-Test | Classif | | Integer, Numeric | [c(“mlr3filters”, “stats”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22stats%22\)) | +| auc | Area Under the ROC Curve Score | Classif | | Integer, Numeric | [c(“mlr3filters”, “mlr3measures”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22mlr3measures%22\)) | +| carscore | Correlation-Adjusted coRrelation Score | Regr | lambda , diagonal, verbose | Numeric | [c(“mlr3filters”, “care”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22care%22\)) | +| cmim | Minimal Conditional Mutual Information Maximization | Classif & Regr | threads | Integer, Numeric, Factor, Ordered | [c(“mlr3filters”, “praznik”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22praznik%22\)) | +| correlation | Correlation | Regr | use , method | Integer, Numeric | [c(“mlr3filters”, “stats”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22stats%22\)) | +| disr | Double Input Symmetrical Relevance | Classif & Regr | threads | Integer, Numeric, Factor, Ordered | [c(“mlr3filters”, “praznik”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22praznik%22\)) | +| find\_correlation | Correlation-based Score | Classif & Regr | use , method | Integer, Numeric | [c(“mlr3filters”, “stats”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22stats%22\)) | +| importance | Importance Score | Universal | method | Logical, Integer, Numeric, Character, Factor, Ordered, POSIXct | | +| information\_gain | Information Gain | Classif & Regr | type , equal , discIntegers, threads | Integer, Numeric, Factor, Ordered | [c(“mlr3filters”, “FSelectorRcpp”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22FSelectorRcpp%22\)) | +| jmi | Joint Mutual Information | Classif & Regr | threads | Integer, Numeric, Factor, Ordered | [c(“mlr3filters”, “praznik”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22praznik%22\)) | +| jmim | Minimal Joint Mutual Information Maximization | Classif & Regr | threads | Integer, Numeric, Factor, Ordered | [c(“mlr3filters”, “praznik”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22praznik%22\)) | +| kruskal\_test | Kruskal-Wallis Test | Classif | na.action | Integer, Numeric | [c(“mlr3filters”, “stats”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22stats%22\)) | +| mim | Mutual Information Maximization | Classif & Regr | threads | Integer, Numeric, Factor, Ordered | [c(“mlr3filters”, “praznik”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22praznik%22\)) | +| mrmr | Minimum Redundancy Maximal Relevancy | Classif & Regr | threads | Integer, Numeric, Factor, Ordered | [c(“mlr3filters”, “praznik”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22praznik%22\)) | +| njmim | Minimal Normalised Joint Mutual Information Maximization | Classif & Regr | threads | Integer, Numeric, Factor, Ordered | [c(“mlr3filters”, “praznik”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22praznik%22\)) | +| performance | Predictive Performance | Universal | method | Logical, Integer, Numeric, Character, Factor, Ordered, POSIXct | | +| permutation | Permutation Score | Universal | standardize, nmc | Logical, Integer, Numeric, Character, Factor, Ordered, POSIXct | | +| relief | RELIEF | Classif & Regr | neighboursCount, sampleSize | Integer, Numeric, Factor, Ordered | [c(“mlr3filters”, “FSelectorRcpp”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22FSelectorRcpp%22\)) | +| selected\_features | Embedded Feature Selection | Classif | method | Logical, Integer, Numeric, Character, Factor, Ordered, POSIXct | | +| variance | Variance | NA | na.rm | Integer, Numeric | [c(“mlr3filters”, “stats”)](https://cran.r-project.org/package=c\(%22mlr3filters%22,%20%22stats%22\)) | ### Variable Importance Filters The following learners allow the extraction of variable importance and therefore are supported by `FilterImportance`: - ## [1] "classif.featureless" "classif.ranger" "classif.rpart" - ## [4] "classif.xgboost" "regr.featureless" "regr.ranger" - ## [7] "regr.rpart" "regr.xgboost" "surv.ranger" - ## [10] "surv.xgboost" + ## [1] "classif.featureless" "classif.ranger" "classif.rpart" + ## [4] "classif.xgboost" "regr.featureless" "regr.ranger" + ## [7] "regr.rpart" "regr.xgboost" If your learner is not listed here but capable of extracting variable importance from the fitted model, the reason is most likely that it is @@ -119,10 +122,11 @@ filter$calculate(task) head(as.data.table(filter), 3) ``` - ## feature score - ## 1: Petal.Width 43.66496 - ## 2: Petal.Length 43.10837 - ## 3: Sepal.Length 10.21944 + ## feature score + ## + ## 1: Petal.Width 44.224198 + ## 2: Petal.Length 43.303520 + ## 3: Sepal.Length 9.618601 ### Performance Filter @@ -131,3 +135,26 @@ head(as.data.table(filter), 3) final outcome using the supplied measure. Any learner can be passed to this filter with `classif.rpart` being the default. Of course, also regression learners can be passed if the task is of type “regr”. + +### Filtering in a Pipeline + +In many cases filtering is only one step in the modeling pipeline. To +select features based on filter values, one can use +[`PipeOpFilter`](https://mlr3pipelines.mlr-org.com/reference/mlr_pipeops_filter.html) +from [mlr3pipelines](https://github.com/mlr-org/mlr3pipelines) to +e.g. select features before training a learner. + +``` r +library(mlr3pipelines) + +task = tsk("spam") + +graph = po("filter", filter = flt("auc"), filter.cutoff = 0.1) %>>% + po("learner", lrn("classif.rpart")) + +learner = as_learner(graph) + +rr = resample(task, learner, rsmp("holdout")) +``` + + ## INFO [09:33:50.870] [mlr3] Applying learner 'auc.classif.rpart' on task 'spam' (iter 1/1) diff --git a/man-roxygen/seealso_filter.R b/man-roxygen/seealso_filter.R index c6def46e..1e1d8709 100644 --- a/man-roxygen/seealso_filter.R +++ b/man-roxygen/seealso_filter.R @@ -1,2 +1,3 @@ #' @seealso -#' [Dictionary][mlr3misc::Dictionary] of [Filters][Filter]: [mlr_filters] +#' * [PipeOpFilter][mlr3pipelines::PipeOpFilter] for filtering in a pipeline +#' * [Dictionary][mlr3misc::Dictionary] of [Filters][Filter]: [mlr_filters] diff --git a/man/Filter.Rd b/man/Filter.Rd index 46e82869..05e1b5b6 100644 --- a/man/Filter.Rd +++ b/man/Filter.Rd @@ -21,7 +21,6 @@ Other Filter: \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters.Rd b/man/mlr_filters.Rd index 01ba242f..f489f5a5 100644 --- a/man/mlr_filters.Rd +++ b/man/mlr_filters.Rd @@ -36,7 +36,6 @@ Other Filter: \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_anova.Rd b/man/mlr_filters_anova.Rd index c4861953..498719af 100644 --- a/man/mlr_filters_anova.Rd +++ b/man/mlr_filters_anova.Rd @@ -20,6 +20,16 @@ head(as.data.table(filter), 3) # transform to p-value 10^(-filter$scores) + +if (requireNamespace("mlr3pipelines")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("anova"), filter.cutoff = 20) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ For a benchmark of filter methods: @@ -30,13 +40,15 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -70,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_auc.Rd b/man/mlr_filters_auc.Rd index b7f71e30..6cb41fc1 100644 --- a/man/mlr_filters_auc.Rd +++ b/man/mlr_filters_auc.Rd @@ -16,6 +16,16 @@ task = mlr3::tsk("pima") filter = flt("auc") filter$calculate(task) head(as.data.table(filter), 3) + +if (requireNamespace("mlr3pipelines")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("auc"), filter.cutoff = 0.1) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ For a benchmark of filter methods: @@ -26,13 +36,15 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -66,10 +78,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_carscore.Rd b/man/mlr_filters_carscore.Rd index 6f4a435c..260525f3 100644 --- a/man/mlr_filters_carscore.Rd +++ b/man/mlr_filters_carscore.Rd @@ -14,25 +14,39 @@ returns the absolute value of the calculated scores. Argument \code{verbose} defaults to \code{FALSE}. } \examples{ -task = mlr3::tsk("mtcars") -filter = flt("carscore") -filter$calculate(task) -head(as.data.table(filter), 3) +if (requireNamespace("care")) { + task = mlr3::tsk("mtcars") + filter = flt("carscore") + filter$calculate(task) + head(as.data.table(filter), 3) +} ## changing filter settings filter = flt("carscore") filter$param_set$values = list("diagonal" = TRUE) filter$calculate(task) head(as.data.table(filter), 3) + +if (requireNamespace("mlr3pipelines") && requireNamespace("care")) { + library("mlr3pipelines") + task = mlr3::tsk("mtcars") + + graph = po("filter", filter = flt("carscore"), filter.cutoff = 0.2) \%>>\% + po("learner", mlr3::lrn("regr.rpart")) + + graph$train(task) +} } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -66,10 +80,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_cmim.Rd b/man/mlr_filters_cmim.Rd index edec86d3..11f48f6c 100644 --- a/man/mlr_filters_cmim.Rd +++ b/man/mlr_filters_cmim.Rd @@ -20,10 +20,22 @@ Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecti of available cores. } \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 (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("cmim"), filter.cutoff = 0.5) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ Kursa MB (2021). @@ -39,14 +51,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, \code{\link{mlr_filters_find_correlation}}, @@ -79,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_correlation.Rd b/man/mlr_filters_correlation.Rd index 8c53cad4..bc42e9f4 100644 --- a/man/mlr_filters_correlation.Rd +++ b/man/mlr_filters_correlation.Rd @@ -20,6 +20,15 @@ filter = FilterCorrelation$new() filter$param_set$values = list("method" = "spearman") filter$calculate(task) as.data.table(filter) +if (requireNamespace("mlr3pipelines")) { + library("mlr3pipelines") + task = mlr3::tsk("boston_housing") + + graph = po("filter", filter = flt("correlation"), filter.cutoff = 0.2) \%>>\% + po("learner", mlr3::lrn("regr.rpart")) + + graph$train(task) +} } \references{ For a benchmark of filter methods: @@ -30,14 +39,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_disr}}, \code{\link{mlr_filters_find_correlation}}, @@ -70,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_disr.Rd b/man/mlr_filters_disr.Rd index 3879a448..bd058adc 100644 --- a/man/mlr_filters_disr.Rd +++ b/man/mlr_filters_disr.Rd @@ -20,10 +20,22 @@ Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecti of available cores. } \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 (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("disr"), filter.cutoff = 0.2) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ Kursa MB (2021). @@ -39,14 +51,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_find_correlation}}, @@ -79,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_find_correlation.Rd b/man/mlr_filters_find_correlation.Rd index e0975667..df105c74 100644 --- a/man/mlr_filters_find_correlation.Rd +++ b/man/mlr_filters_find_correlation.Rd @@ -18,7 +18,6 @@ Subsequently \code{caret::findCorrelation(cutoff = 0.9)} lists the same features that are excluded with \code{FilterFindCorrelation} at score 0.1 (= 1 - 0.9). } \examples{ -## Pearson (default) task = mlr3::tsk("mtcars") filter = flt("find_correlation") filter$calculate(task) @@ -28,16 +27,27 @@ as.data.table(filter) filter = flt("find_correlation", method = "spearman") filter$calculate(task) as.data.table(filter) + +if (requireNamespace("mlr3pipelines")) { + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("find_correlation"), filter.cutoff = 0.4) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -70,10 +80,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_importance.Rd b/man/mlr_filters_importance.Rd index 3995acd7..1227f378 100644 --- a/man/mlr_filters_importance.Rd +++ b/man/mlr_filters_importance.Rd @@ -16,16 +16,31 @@ learner = mlr3::lrn("classif.rpart") filter = flt("importance", learner = learner) filter$calculate(task) as.data.table(filter) + +if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && requireNamespace("MASS")) { + library("mlr3learners") + library("mlr3pipelines") + task = mlr3::tsk("spam") + + learner = mlr3::lrn("classif.rpart") + + graph = po("filter", filter = flt("importance", learner = learner), filter.cutoff = 100) \%>>\% + po("learner", mlr3::lrn("classif.lda")) + + graph$train(task) +} } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -66,10 +81,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_information_gain.Rd b/man/mlr_filters_information_gain.Rd index 54b0b1ac..589793d7 100644 --- a/man/mlr_filters_information_gain.Rd +++ b/man/mlr_filters_information_gain.Rd @@ -15,29 +15,45 @@ Argument \code{equal} defaults to \code{FALSE} for classification tasks, and to \code{TRUE} for regression tasks. } \examples{ -## InfoGain (default) -task = mlr3::tsk("pima") -filter = flt("information_gain") -filter$calculate(task) -head(filter$scores, 3) -as.data.table(filter) +if (requireNamespace("FSelectorRcpp")) { + ## InfoGain (default) + task = mlr3::tsk("pima") + filter = flt("information_gain") + filter$calculate(task) + head(filter$scores, 3) + as.data.table(filter) -## GainRatio + ## GainRatio + + filterGR = flt("information_gain") + filterGR$param_set$values = list("type" = "gainratio") + filterGR$calculate(task) + head(as.data.table(filterGR), 3) -filterGR = flt("information_gain") -filterGR$param_set$values = list("type" = "gainratio") -filterGR$calculate(task) -head(as.data.table(filterGR), 3) +} + +if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("information_gain"), filter.cutoff = 0.1) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) + +} } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -70,10 +86,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmi.Rd b/man/mlr_filters_jmi.Rd index 7a28f22f..1ef760f1 100644 --- a/man/mlr_filters_jmi.Rd +++ b/man/mlr_filters_jmi.Rd @@ -20,10 +20,22 @@ Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecti of available cores. } \examples{ -task = mlr3::tsk("iris") -filter = flt("jmi") -filter$calculate(task, nfeat = 2) -as.data.table(filter) +if (requireNamespace("praznik")) { + task = mlr3::tsk("iris") + filter = flt("jmi") + filter$calculate(task, nfeat = 2) + as.data.table(filter) +} + +if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("jmi"), filter.cutoff = 0.2) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ Kursa MB (2021). @@ -39,14 +51,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -79,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmim.Rd b/man/mlr_filters_jmim.Rd index b804db2c..a247eed0 100644 --- a/man/mlr_filters_jmim.Rd +++ b/man/mlr_filters_jmim.Rd @@ -20,10 +20,23 @@ Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecti of available cores. } \examples{ -task = mlr3::tsk("iris") -filter = flt("jmim") -filter$calculate(task, nfeat = 2) -as.data.table(filter) +if (requireNamespace("praznik")) { + task = mlr3::tsk("iris") + filter = flt("jmim") + filter$calculate(task, nfeat = 2) + as.data.table(filter) +} + + +if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("jmim"), filter.cutoff = 0.5) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ Kursa MB (2021). @@ -39,14 +52,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -79,10 +94,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_kruskal_test.Rd b/man/mlr_filters_kruskal_test.Rd index ad89ff09..7d9471e2 100644 --- a/man/mlr_filters_kruskal_test.Rd +++ b/man/mlr_filters_kruskal_test.Rd @@ -19,6 +19,16 @@ as.data.table(filter) # transform to p-value 10^(-filter$scores) + +if (requireNamespace("mlr3pipelines")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("kruskal_test"), filter.cutoff = 0.2) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ For a benchmark of filter methods: @@ -29,14 +39,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -69,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mim.Rd b/man/mlr_filters_mim.Rd index f65c8e35..b5c3332f 100644 --- a/man/mlr_filters_mim.Rd +++ b/man/mlr_filters_mim.Rd @@ -20,10 +20,24 @@ Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecti of available cores. } \examples{ -task = mlr3::tsk("iris") -filter = flt("mim") -filter$calculate(task, nfeat = 2) -as.data.table(filter) + +if (requireNamespace("praznik")) { + task = mlr3::tsk("iris") + filter = flt("mim") + filter$calculate(task, nfeat = 2) + as.data.table(filter) +} + + +if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("mim"), filter.cutoff = 0.3) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ Kursa MB (2021). @@ -39,14 +53,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -79,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mrmr.Rd b/man/mlr_filters_mrmr.Rd index 600d0d90..5a9a6d60 100644 --- a/man/mlr_filters_mrmr.Rd +++ b/man/mlr_filters_mrmr.Rd @@ -20,10 +20,22 @@ Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecti of available cores. } \examples{ -task = mlr3::tsk("iris") -filter = flt("mrmr") -filter$calculate(task, nfeat = 2) -as.data.table(filter) +if (requireNamespace("praznik")) { + task = mlr3::tsk("iris") + filter = flt("mrmr") + filter$calculate(task, nfeat = 2) + as.data.table(filter) +} + +if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("mrmr"), filter.cutoff = 0.4) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ Kursa MB (2021). @@ -39,14 +51,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -79,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_njmim.Rd b/man/mlr_filters_njmim.Rd index 1aa63da5..d14dc237 100644 --- a/man/mlr_filters_njmim.Rd +++ b/man/mlr_filters_njmim.Rd @@ -20,10 +20,22 @@ Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecti of available cores. } \examples{ -task = mlr3::tsk("iris") -filter = flt("njmim") -filter$calculate(task, nfeat = 2) -as.data.table(filter) +if (requireNamespace("praznik")) { + task = mlr3::tsk("iris") + filter = flt("njmim") + filter$calculate(task, nfeat = 2) + as.data.table(filter) +} + +if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("njmim"), filter.cutoff = 0.4) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ Kursa MB (2021). @@ -39,14 +51,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -79,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_performance.Rd b/man/mlr_filters_performance.Rd index 122c450c..75d9310d 100644 --- a/man/mlr_filters_performance.Rd +++ b/man/mlr_filters_performance.Rd @@ -17,16 +17,27 @@ learner = mlr3::lrn("classif.rpart") filter = flt("performance", learner = learner) filter$calculate(task) as.data.table(filter) +if (requireNamespace("mlr3pipelines")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("performance", learner = lrn("classif.rpart")), filter.cutoff = -0.3) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -70,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_permutation.Rd b/man/mlr_filters_permutation.Rd index 933f9f32..62c44fa0 100644 --- a/man/mlr_filters_permutation.Rd +++ b/man/mlr_filters_permutation.Rd @@ -22,15 +22,36 @@ Number of Monte-Carlo iterations to use in computing the feature importance. } } +\examples{ +learner = mlr3::lrn("classif.rpart") +resampling = mlr3::rsmp("holdout") +measure = mlr3::msr("classif.acc") +filter = flt("permutation", learner = learner, measure = measure, resampling = resampling, nmc = 2) +task = mlr3::tsk("iris") +filter$calculate(task) +as.data.table(filter) + +if (requireNamespace("mlr3pipelines")) { + library("mlr3pipelines") + task = mlr3::tsk("iris") + + graph = po("filter", filter = flt("permutation", nmc = 2), filter.cutoff = 0.1) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} +} \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -74,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_relief.Rd b/man/mlr_filters_relief.Rd index 0a6cc967..e09f14ad 100644 --- a/man/mlr_filters_relief.Rd +++ b/man/mlr_filters_relief.Rd @@ -9,22 +9,36 @@ Information gain filter calling \code{\link[FSelectorRcpp:relief]{FSelectorRcpp::relief()}} in package \CRANpkg{FSelectorRcpp}. } \examples{ -## Relief (default) -task = mlr3::tsk("pima") -filter = flt("relief") -filter$calculate(task) -head(filter$scores, 3) -as.data.table(filter) +if (requireNamespace("FSelectorRcpp")) { + ## Relief (default) + task = mlr3::tsk("pima") + filter = flt("relief") + filter$calculate(task) + head(filter$scores, 3) + as.data.table(filter) +} + +if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { + library("mlr3pipelines") + task = mlr3::tsk("iris") + + graph = po("filter", filter = flt("relief"), filter.cutoff = 0.15) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -57,10 +71,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_selected_features.Rd b/man/mlr_filters_selected_features.Rd index e52e43a5..f644b21e 100644 --- a/man/mlr_filters_selected_features.Rd +++ b/man/mlr_filters_selected_features.Rd @@ -24,14 +24,16 @@ filter$calculate(task) as.data.table(filter) } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -72,10 +74,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} @@ -89,6 +91,14 @@ Learner to extract the selected features from. \if{html}{\out{
}}\preformatted{FilterSelectedFeatures$new(learner = mlr3::lrn("classif.featureless"))}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{learner}}{(\code{Learner})\cr +Learner with property \code{"selected_features"}.} +} +\if{html}{\out{
}} +} } \if{html}{\out{
}} \if{html}{\out{}} diff --git a/man/mlr_filters_variance.Rd b/man/mlr_filters_variance.Rd index e27758b6..0e9f67e0 100644 --- a/man/mlr_filters_variance.Rd +++ b/man/mlr_filters_variance.Rd @@ -15,6 +15,16 @@ filter = flt("variance") filter$calculate(task) head(filter$scores, 3) as.data.table(filter) + +if (requireNamespace("mlr3pipelines")) { + library("mlr3pipelines") + task = mlr3::tsk("spam") + + graph = po("filter", filter = flt("variance"), filter.cutoff = 1) \%>>\% + po("learner", mlr3::lrn("classif.rpart")) + + graph$train(task) +} } \references{ For a benchmark of filter methods: @@ -25,14 +35,16 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). \doi{10.1016/j.csda.2019.106839}. } \seealso{ -\link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +\itemize{ +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} +} Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, \code{\link{mlr_filters_carscore}}, -\code{\link{mlr_filters_carsurvscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, @@ -65,10 +77,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} From f26f83cf871fe17fcc52fc959386cdb7204e8a64 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Aug 2022 10:12:58 +0000 Subject: [PATCH 03/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- R/FilterFindCorrelation.R | 2 +- README.Rmd | 3 --- man/mlr_filters_anova.Rd | 10 +++++----- man/mlr_filters_auc.Rd | 10 +++++----- man/mlr_filters_carscore.Rd | 10 +++++----- man/mlr_filters_cmim.Rd | 10 +++++----- man/mlr_filters_correlation.Rd | 10 +++++----- man/mlr_filters_disr.Rd | 10 +++++----- man/mlr_filters_find_correlation.Rd | 11 ++++++----- man/mlr_filters_importance.Rd | 10 +++++----- man/mlr_filters_information_gain.Rd | 10 +++++----- man/mlr_filters_jmi.Rd | 10 +++++----- man/mlr_filters_jmim.Rd | 10 +++++----- man/mlr_filters_kruskal_test.Rd | 10 +++++----- man/mlr_filters_mim.Rd | 10 +++++----- man/mlr_filters_mrmr.Rd | 10 +++++----- man/mlr_filters_njmim.Rd | 10 +++++----- man/mlr_filters_performance.Rd | 10 +++++----- man/mlr_filters_permutation.Rd | 10 +++++----- man/mlr_filters_relief.Rd | 10 +++++----- man/mlr_filters_selected_features.Rd | 10 +++++----- man/mlr_filters_variance.Rd | 10 +++++----- 22 files changed, 102 insertions(+), 104 deletions(-) diff --git a/R/FilterFindCorrelation.R b/R/FilterFindCorrelation.R index 919e0450..8b9e87da 100644 --- a/R/FilterFindCorrelation.R +++ b/R/FilterFindCorrelation.R @@ -19,7 +19,7 @@ #' @template seealso_filter #' @export #' @examples -## Pearson (default) +#' # Pearson (default) #' task = mlr3::tsk("mtcars") #' filter = flt("find_correlation") #' filter$calculate(task) diff --git a/README.Rmd b/README.Rmd index deae3065..84b9d991 100644 --- a/README.Rmd +++ b/README.Rmd @@ -134,6 +134,3 @@ learner = as_learner(graph) rr = resample(task, learner, rsmp("holdout")) ``` - - - diff --git a/man/mlr_filters_anova.Rd b/man/mlr_filters_anova.Rd index 498719af..0a169780 100644 --- a/man/mlr_filters_anova.Rd +++ b/man/mlr_filters_anova.Rd @@ -41,7 +41,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_auc.Rd b/man/mlr_filters_auc.Rd index 6cb41fc1..f46d27cb 100644 --- a/man/mlr_filters_auc.Rd +++ b/man/mlr_filters_auc.Rd @@ -37,7 +37,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -78,10 +78,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_carscore.Rd b/man/mlr_filters_carscore.Rd index 260525f3..11b6e2c6 100644 --- a/man/mlr_filters_carscore.Rd +++ b/man/mlr_filters_carscore.Rd @@ -39,7 +39,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("care")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -80,10 +80,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_cmim.Rd b/man/mlr_filters_cmim.Rd index 11f48f6c..1bfdddfd 100644 --- a/man/mlr_filters_cmim.Rd +++ b/man/mlr_filters_cmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_correlation.Rd b/man/mlr_filters_correlation.Rd index bc42e9f4..03457318 100644 --- a/man/mlr_filters_correlation.Rd +++ b/man/mlr_filters_correlation.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_disr.Rd b/man/mlr_filters_disr.Rd index bd058adc..ae801b19 100644 --- a/man/mlr_filters_disr.Rd +++ b/man/mlr_filters_disr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_find_correlation.Rd b/man/mlr_filters_find_correlation.Rd index df105c74..d18c59c2 100644 --- a/man/mlr_filters_find_correlation.Rd +++ b/man/mlr_filters_find_correlation.Rd @@ -18,6 +18,7 @@ Subsequently \code{caret::findCorrelation(cutoff = 0.9)} lists the same features that are excluded with \code{FilterFindCorrelation} at score 0.1 (= 1 - 0.9). } \examples{ +# Pearson (default) task = mlr3::tsk("mtcars") filter = flt("find_correlation") filter$calculate(task) @@ -39,7 +40,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -80,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_importance.Rd b/man/mlr_filters_importance.Rd index 1227f378..9bdff282 100644 --- a/man/mlr_filters_importance.Rd +++ b/man/mlr_filters_importance.Rd @@ -32,7 +32,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && req } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_information_gain.Rd b/man/mlr_filters_information_gain.Rd index 589793d7..95913078 100644 --- a/man/mlr_filters_information_gain.Rd +++ b/man/mlr_filters_information_gain.Rd @@ -45,7 +45,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -86,10 +86,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmi.Rd b/man/mlr_filters_jmi.Rd index 1ef760f1..c8ebb678 100644 --- a/man/mlr_filters_jmi.Rd +++ b/man/mlr_filters_jmi.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmim.Rd b/man/mlr_filters_jmim.Rd index a247eed0..08adcacd 100644 --- a/man/mlr_filters_jmim.Rd +++ b/man/mlr_filters_jmim.Rd @@ -53,7 +53,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -94,10 +94,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_kruskal_test.Rd b/man/mlr_filters_kruskal_test.Rd index 7d9471e2..ea400db9 100644 --- a/man/mlr_filters_kruskal_test.Rd +++ b/man/mlr_filters_kruskal_test.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mim.Rd b/man/mlr_filters_mim.Rd index b5c3332f..9c019e85 100644 --- a/man/mlr_filters_mim.Rd +++ b/man/mlr_filters_mim.Rd @@ -54,7 +54,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mrmr.Rd b/man/mlr_filters_mrmr.Rd index 5a9a6d60..a1b7e70c 100644 --- a/man/mlr_filters_mrmr.Rd +++ b/man/mlr_filters_mrmr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_njmim.Rd b/man/mlr_filters_njmim.Rd index d14dc237..5876cf48 100644 --- a/man/mlr_filters_njmim.Rd +++ b/man/mlr_filters_njmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_performance.Rd b/man/mlr_filters_performance.Rd index 75d9310d..3bc04728 100644 --- a/man/mlr_filters_performance.Rd +++ b/man/mlr_filters_performance.Rd @@ -29,7 +29,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_permutation.Rd b/man/mlr_filters_permutation.Rd index 62c44fa0..3b55ffe7 100644 --- a/man/mlr_filters_permutation.Rd +++ b/man/mlr_filters_permutation.Rd @@ -43,7 +43,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_relief.Rd b/man/mlr_filters_relief.Rd index e09f14ad..ccd2d304 100644 --- a/man/mlr_filters_relief.Rd +++ b/man/mlr_filters_relief.Rd @@ -30,7 +30,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -71,10 +71,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_selected_features.Rd b/man/mlr_filters_selected_features.Rd index f644b21e..c42dbc33 100644 --- a/man/mlr_filters_selected_features.Rd +++ b/man/mlr_filters_selected_features.Rd @@ -25,7 +25,7 @@ as.data.table(filter) } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -74,10 +74,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_variance.Rd b/man/mlr_filters_variance.Rd index 0e9f67e0..9200bd2e 100644 --- a/man/mlr_filters_variance.Rd +++ b/man/mlr_filters_variance.Rd @@ -36,7 +36,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -77,10 +77,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} From 3d018c34dde1d3662c13e5ab6063f7227bff91f8 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 8 Aug 2022 12:18:53 +0200 Subject: [PATCH 04/11] fix: example --- R/FilterFindCorrelation.R | 1 + man/mlr_filters_find_correlation.Rd | 1 + 2 files changed, 2 insertions(+) diff --git a/R/FilterFindCorrelation.R b/R/FilterFindCorrelation.R index 919e0450..a59925ed 100644 --- a/R/FilterFindCorrelation.R +++ b/R/FilterFindCorrelation.R @@ -31,6 +31,7 @@ #' as.data.table(filter) #' #' if (requireNamespace("mlr3pipelines")) { +#' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' #' graph = po("filter", filter = flt("find_correlation"), filter.cutoff = 0.4) %>>% diff --git a/man/mlr_filters_find_correlation.Rd b/man/mlr_filters_find_correlation.Rd index df105c74..38ebc6d4 100644 --- a/man/mlr_filters_find_correlation.Rd +++ b/man/mlr_filters_find_correlation.Rd @@ -29,6 +29,7 @@ filter$calculate(task) as.data.table(filter) if (requireNamespace("mlr3pipelines")) { + library("mlr3pipelines") task = mlr3::tsk("spam") graph = po("filter", filter = flt("find_correlation"), filter.cutoff = 0.4) \%>>\% From e01bfbb17fdb901785cb78e79b78948a5dc4efb6 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 8 Aug 2022 12:20:49 +0200 Subject: [PATCH 05/11] fix: example filter importance + document --- R/FilterImportance.R | 3 ++- man/mlr_filters_anova.Rd | 10 +++++----- man/mlr_filters_auc.Rd | 10 +++++----- man/mlr_filters_carscore.Rd | 10 +++++----- man/mlr_filters_cmim.Rd | 10 +++++----- man/mlr_filters_correlation.Rd | 10 +++++----- man/mlr_filters_disr.Rd | 10 +++++----- man/mlr_filters_find_correlation.Rd | 10 +++++----- man/mlr_filters_importance.Rd | 13 +++++++------ man/mlr_filters_information_gain.Rd | 10 +++++----- man/mlr_filters_jmi.Rd | 10 +++++----- man/mlr_filters_jmim.Rd | 10 +++++----- man/mlr_filters_kruskal_test.Rd | 10 +++++----- man/mlr_filters_mim.Rd | 10 +++++----- man/mlr_filters_mrmr.Rd | 10 +++++----- man/mlr_filters_njmim.Rd | 10 +++++----- man/mlr_filters_performance.Rd | 10 +++++----- man/mlr_filters_permutation.Rd | 10 +++++----- man/mlr_filters_relief.Rd | 10 +++++----- man/mlr_filters_selected_features.Rd | 10 +++++----- man/mlr_filters_variance.Rd | 10 +++++----- 21 files changed, 104 insertions(+), 102 deletions(-) diff --git a/R/FilterImportance.R b/R/FilterImportance.R index d1644e92..fd4d1c68 100644 --- a/R/FilterImportance.R +++ b/R/FilterImportance.R @@ -17,7 +17,8 @@ #' filter$calculate(task) #' as.data.table(filter) #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && requireNamespace("MASS")) { +#' if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && +#' requireNamespace("MASS")) { #' library("mlr3learners") #' library("mlr3pipelines") #' task = mlr3::tsk("spam") diff --git a/man/mlr_filters_anova.Rd b/man/mlr_filters_anova.Rd index 0a169780..498719af 100644 --- a/man/mlr_filters_anova.Rd +++ b/man/mlr_filters_anova.Rd @@ -41,7 +41,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_auc.Rd b/man/mlr_filters_auc.Rd index f46d27cb..6cb41fc1 100644 --- a/man/mlr_filters_auc.Rd +++ b/man/mlr_filters_auc.Rd @@ -37,7 +37,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -78,10 +78,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_carscore.Rd b/man/mlr_filters_carscore.Rd index 11b6e2c6..260525f3 100644 --- a/man/mlr_filters_carscore.Rd +++ b/man/mlr_filters_carscore.Rd @@ -39,7 +39,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("care")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -80,10 +80,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_cmim.Rd b/man/mlr_filters_cmim.Rd index 1bfdddfd..11f48f6c 100644 --- a/man/mlr_filters_cmim.Rd +++ b/man/mlr_filters_cmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_correlation.Rd b/man/mlr_filters_correlation.Rd index 03457318..bc42e9f4 100644 --- a/man/mlr_filters_correlation.Rd +++ b/man/mlr_filters_correlation.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_disr.Rd b/man/mlr_filters_disr.Rd index ae801b19..bd058adc 100644 --- a/man/mlr_filters_disr.Rd +++ b/man/mlr_filters_disr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_find_correlation.Rd b/man/mlr_filters_find_correlation.Rd index 5378f731..1f586366 100644 --- a/man/mlr_filters_find_correlation.Rd +++ b/man/mlr_filters_find_correlation.Rd @@ -41,7 +41,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_importance.Rd b/man/mlr_filters_importance.Rd index 9bdff282..57b478ac 100644 --- a/man/mlr_filters_importance.Rd +++ b/man/mlr_filters_importance.Rd @@ -17,7 +17,8 @@ filter = flt("importance", learner = learner) filter$calculate(task) as.data.table(filter) -if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && requireNamespace("MASS")) { +if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && + requireNamespace("MASS")) { library("mlr3learners") library("mlr3pipelines") task = mlr3::tsk("spam") @@ -32,7 +33,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && req } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +82,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_information_gain.Rd b/man/mlr_filters_information_gain.Rd index 95913078..589793d7 100644 --- a/man/mlr_filters_information_gain.Rd +++ b/man/mlr_filters_information_gain.Rd @@ -45,7 +45,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -86,10 +86,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmi.Rd b/man/mlr_filters_jmi.Rd index c8ebb678..1ef760f1 100644 --- a/man/mlr_filters_jmi.Rd +++ b/man/mlr_filters_jmi.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmim.Rd b/man/mlr_filters_jmim.Rd index 08adcacd..a247eed0 100644 --- a/man/mlr_filters_jmim.Rd +++ b/man/mlr_filters_jmim.Rd @@ -53,7 +53,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -94,10 +94,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_kruskal_test.Rd b/man/mlr_filters_kruskal_test.Rd index ea400db9..7d9471e2 100644 --- a/man/mlr_filters_kruskal_test.Rd +++ b/man/mlr_filters_kruskal_test.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mim.Rd b/man/mlr_filters_mim.Rd index 9c019e85..b5c3332f 100644 --- a/man/mlr_filters_mim.Rd +++ b/man/mlr_filters_mim.Rd @@ -54,7 +54,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mrmr.Rd b/man/mlr_filters_mrmr.Rd index a1b7e70c..5a9a6d60 100644 --- a/man/mlr_filters_mrmr.Rd +++ b/man/mlr_filters_mrmr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_njmim.Rd b/man/mlr_filters_njmim.Rd index 5876cf48..d14dc237 100644 --- a/man/mlr_filters_njmim.Rd +++ b/man/mlr_filters_njmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_performance.Rd b/man/mlr_filters_performance.Rd index 3bc04728..75d9310d 100644 --- a/man/mlr_filters_performance.Rd +++ b/man/mlr_filters_performance.Rd @@ -29,7 +29,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_permutation.Rd b/man/mlr_filters_permutation.Rd index 3b55ffe7..62c44fa0 100644 --- a/man/mlr_filters_permutation.Rd +++ b/man/mlr_filters_permutation.Rd @@ -43,7 +43,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_relief.Rd b/man/mlr_filters_relief.Rd index ccd2d304..e09f14ad 100644 --- a/man/mlr_filters_relief.Rd +++ b/man/mlr_filters_relief.Rd @@ -30,7 +30,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -71,10 +71,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_selected_features.Rd b/man/mlr_filters_selected_features.Rd index c42dbc33..f644b21e 100644 --- a/man/mlr_filters_selected_features.Rd +++ b/man/mlr_filters_selected_features.Rd @@ -25,7 +25,7 @@ as.data.table(filter) } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -74,10 +74,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_variance.Rd b/man/mlr_filters_variance.Rd index 9200bd2e..0e9f67e0 100644 --- a/man/mlr_filters_variance.Rd +++ b/man/mlr_filters_variance.Rd @@ -36,7 +36,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -77,10 +77,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} From 56faaba59097bc3421c493572de506c81d118832 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Aug 2022 10:21:45 +0000 Subject: [PATCH 06/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- man/mlr_filters_anova.Rd | 10 +++++----- man/mlr_filters_auc.Rd | 10 +++++----- man/mlr_filters_carscore.Rd | 10 +++++----- man/mlr_filters_cmim.Rd | 10 +++++----- man/mlr_filters_correlation.Rd | 10 +++++----- man/mlr_filters_disr.Rd | 10 +++++----- man/mlr_filters_find_correlation.Rd | 10 +++++----- man/mlr_filters_importance.Rd | 10 +++++----- man/mlr_filters_information_gain.Rd | 10 +++++----- man/mlr_filters_jmi.Rd | 10 +++++----- man/mlr_filters_jmim.Rd | 10 +++++----- man/mlr_filters_kruskal_test.Rd | 10 +++++----- man/mlr_filters_mim.Rd | 10 +++++----- man/mlr_filters_mrmr.Rd | 10 +++++----- man/mlr_filters_njmim.Rd | 10 +++++----- man/mlr_filters_performance.Rd | 10 +++++----- man/mlr_filters_permutation.Rd | 10 +++++----- man/mlr_filters_relief.Rd | 10 +++++----- man/mlr_filters_selected_features.Rd | 10 +++++----- man/mlr_filters_variance.Rd | 10 +++++----- 20 files changed, 100 insertions(+), 100 deletions(-) diff --git a/man/mlr_filters_anova.Rd b/man/mlr_filters_anova.Rd index 498719af..0a169780 100644 --- a/man/mlr_filters_anova.Rd +++ b/man/mlr_filters_anova.Rd @@ -41,7 +41,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_auc.Rd b/man/mlr_filters_auc.Rd index 6cb41fc1..f46d27cb 100644 --- a/man/mlr_filters_auc.Rd +++ b/man/mlr_filters_auc.Rd @@ -37,7 +37,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -78,10 +78,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_carscore.Rd b/man/mlr_filters_carscore.Rd index 260525f3..11b6e2c6 100644 --- a/man/mlr_filters_carscore.Rd +++ b/man/mlr_filters_carscore.Rd @@ -39,7 +39,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("care")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -80,10 +80,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_cmim.Rd b/man/mlr_filters_cmim.Rd index 11f48f6c..1bfdddfd 100644 --- a/man/mlr_filters_cmim.Rd +++ b/man/mlr_filters_cmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_correlation.Rd b/man/mlr_filters_correlation.Rd index bc42e9f4..03457318 100644 --- a/man/mlr_filters_correlation.Rd +++ b/man/mlr_filters_correlation.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_disr.Rd b/man/mlr_filters_disr.Rd index bd058adc..ae801b19 100644 --- a/man/mlr_filters_disr.Rd +++ b/man/mlr_filters_disr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_find_correlation.Rd b/man/mlr_filters_find_correlation.Rd index 1f586366..5378f731 100644 --- a/man/mlr_filters_find_correlation.Rd +++ b/man/mlr_filters_find_correlation.Rd @@ -41,7 +41,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_importance.Rd b/man/mlr_filters_importance.Rd index 57b478ac..bd064400 100644 --- a/man/mlr_filters_importance.Rd +++ b/man/mlr_filters_importance.Rd @@ -33,7 +33,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_information_gain.Rd b/man/mlr_filters_information_gain.Rd index 589793d7..95913078 100644 --- a/man/mlr_filters_information_gain.Rd +++ b/man/mlr_filters_information_gain.Rd @@ -45,7 +45,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -86,10 +86,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmi.Rd b/man/mlr_filters_jmi.Rd index 1ef760f1..c8ebb678 100644 --- a/man/mlr_filters_jmi.Rd +++ b/man/mlr_filters_jmi.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmim.Rd b/man/mlr_filters_jmim.Rd index a247eed0..08adcacd 100644 --- a/man/mlr_filters_jmim.Rd +++ b/man/mlr_filters_jmim.Rd @@ -53,7 +53,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -94,10 +94,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_kruskal_test.Rd b/man/mlr_filters_kruskal_test.Rd index 7d9471e2..ea400db9 100644 --- a/man/mlr_filters_kruskal_test.Rd +++ b/man/mlr_filters_kruskal_test.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mim.Rd b/man/mlr_filters_mim.Rd index b5c3332f..9c019e85 100644 --- a/man/mlr_filters_mim.Rd +++ b/man/mlr_filters_mim.Rd @@ -54,7 +54,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mrmr.Rd b/man/mlr_filters_mrmr.Rd index 5a9a6d60..a1b7e70c 100644 --- a/man/mlr_filters_mrmr.Rd +++ b/man/mlr_filters_mrmr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_njmim.Rd b/man/mlr_filters_njmim.Rd index d14dc237..5876cf48 100644 --- a/man/mlr_filters_njmim.Rd +++ b/man/mlr_filters_njmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_performance.Rd b/man/mlr_filters_performance.Rd index 75d9310d..3bc04728 100644 --- a/man/mlr_filters_performance.Rd +++ b/man/mlr_filters_performance.Rd @@ -29,7 +29,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_permutation.Rd b/man/mlr_filters_permutation.Rd index 62c44fa0..3b55ffe7 100644 --- a/man/mlr_filters_permutation.Rd +++ b/man/mlr_filters_permutation.Rd @@ -43,7 +43,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_relief.Rd b/man/mlr_filters_relief.Rd index e09f14ad..ccd2d304 100644 --- a/man/mlr_filters_relief.Rd +++ b/man/mlr_filters_relief.Rd @@ -30,7 +30,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -71,10 +71,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_selected_features.Rd b/man/mlr_filters_selected_features.Rd index f644b21e..c42dbc33 100644 --- a/man/mlr_filters_selected_features.Rd +++ b/man/mlr_filters_selected_features.Rd @@ -25,7 +25,7 @@ as.data.table(filter) } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -74,10 +74,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_variance.Rd b/man/mlr_filters_variance.Rd index 0e9f67e0..9200bd2e 100644 --- a/man/mlr_filters_variance.Rd +++ b/man/mlr_filters_variance.Rd @@ -36,7 +36,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -77,10 +77,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} From f1551be9c45f9f5b9f31a958365e355873e9b530 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 8 Aug 2022 12:42:09 +0200 Subject: [PATCH 07/11] fix: examples --- R/FilterImportance.R | 12 +++++++----- R/FilterPerformance.R | 3 ++- man/mlr_filters_importance.Rd | 12 +++++++----- man/mlr_filters_performance.Rd | 3 ++- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/R/FilterImportance.R b/R/FilterImportance.R index fd4d1c68..3db9a826 100644 --- a/R/FilterImportance.R +++ b/R/FilterImportance.R @@ -11,11 +11,13 @@ #' @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 (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && #' requireNamespace("MASS")) { diff --git a/R/FilterPerformance.R b/R/FilterPerformance.R index 05866271..61b63ab1 100644 --- a/R/FilterPerformance.R +++ b/R/FilterPerformance.R @@ -20,8 +20,9 @@ #' if (requireNamespace("mlr3pipelines")) { #' library("mlr3pipelines") #' task = mlr3::tsk("spam") +#' l = lrn("classif.rpart") #' -#' graph = po("filter", filter = flt("performance", learner = lrn("classif.rpart")), filter.cutoff = -0.3) %>>% +#' graph = po("filter", filter = flt("performance", learner = l), filter.cutoff = -0.3) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/man/mlr_filters_importance.Rd b/man/mlr_filters_importance.Rd index 57b478ac..a9a664d0 100644 --- a/man/mlr_filters_importance.Rd +++ b/man/mlr_filters_importance.Rd @@ -11,11 +11,13 @@ extracting the variable importance (property "importance"), fits the model and extracts the importance values to use as filter scores. } \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 (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && requireNamespace("MASS")) { diff --git a/man/mlr_filters_performance.Rd b/man/mlr_filters_performance.Rd index 75d9310d..d1696b35 100644 --- a/man/mlr_filters_performance.Rd +++ b/man/mlr_filters_performance.Rd @@ -20,8 +20,9 @@ as.data.table(filter) if (requireNamespace("mlr3pipelines")) { library("mlr3pipelines") task = mlr3::tsk("spam") + l = lrn("classif.rpart") - graph = po("filter", filter = flt("performance", learner = lrn("classif.rpart")), filter.cutoff = -0.3) \%>>\% + graph = po("filter", filter = flt("performance", learner = l), filter.cutoff = -0.3) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) From 8032f7b24480bec1a60d40a1d28caf531208bbe9 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 8 Aug 2022 12:43:04 +0200 Subject: [PATCH 08/11] docs: document --- man/mlr_filters_anova.Rd | 10 +++++----- man/mlr_filters_auc.Rd | 10 +++++----- man/mlr_filters_carscore.Rd | 10 +++++----- man/mlr_filters_cmim.Rd | 10 +++++----- man/mlr_filters_correlation.Rd | 10 +++++----- man/mlr_filters_disr.Rd | 10 +++++----- man/mlr_filters_find_correlation.Rd | 10 +++++----- man/mlr_filters_importance.Rd | 10 +++++----- man/mlr_filters_information_gain.Rd | 10 +++++----- man/mlr_filters_jmi.Rd | 10 +++++----- man/mlr_filters_jmim.Rd | 10 +++++----- man/mlr_filters_kruskal_test.Rd | 10 +++++----- man/mlr_filters_mim.Rd | 10 +++++----- man/mlr_filters_mrmr.Rd | 10 +++++----- man/mlr_filters_njmim.Rd | 10 +++++----- man/mlr_filters_performance.Rd | 10 +++++----- man/mlr_filters_permutation.Rd | 10 +++++----- man/mlr_filters_relief.Rd | 10 +++++----- man/mlr_filters_selected_features.Rd | 10 +++++----- man/mlr_filters_variance.Rd | 10 +++++----- 20 files changed, 100 insertions(+), 100 deletions(-) diff --git a/man/mlr_filters_anova.Rd b/man/mlr_filters_anova.Rd index 0a169780..498719af 100644 --- a/man/mlr_filters_anova.Rd +++ b/man/mlr_filters_anova.Rd @@ -41,7 +41,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_auc.Rd b/man/mlr_filters_auc.Rd index f46d27cb..6cb41fc1 100644 --- a/man/mlr_filters_auc.Rd +++ b/man/mlr_filters_auc.Rd @@ -37,7 +37,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -78,10 +78,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_carscore.Rd b/man/mlr_filters_carscore.Rd index 11b6e2c6..260525f3 100644 --- a/man/mlr_filters_carscore.Rd +++ b/man/mlr_filters_carscore.Rd @@ -39,7 +39,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("care")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -80,10 +80,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_cmim.Rd b/man/mlr_filters_cmim.Rd index 1bfdddfd..11f48f6c 100644 --- a/man/mlr_filters_cmim.Rd +++ b/man/mlr_filters_cmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_correlation.Rd b/man/mlr_filters_correlation.Rd index 03457318..bc42e9f4 100644 --- a/man/mlr_filters_correlation.Rd +++ b/man/mlr_filters_correlation.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_disr.Rd b/man/mlr_filters_disr.Rd index ae801b19..bd058adc 100644 --- a/man/mlr_filters_disr.Rd +++ b/man/mlr_filters_disr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_find_correlation.Rd b/man/mlr_filters_find_correlation.Rd index 5378f731..1f586366 100644 --- a/man/mlr_filters_find_correlation.Rd +++ b/man/mlr_filters_find_correlation.Rd @@ -41,7 +41,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_importance.Rd b/man/mlr_filters_importance.Rd index e8f28628..a9a664d0 100644 --- a/man/mlr_filters_importance.Rd +++ b/man/mlr_filters_importance.Rd @@ -35,7 +35,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -84,10 +84,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_information_gain.Rd b/man/mlr_filters_information_gain.Rd index 95913078..589793d7 100644 --- a/man/mlr_filters_information_gain.Rd +++ b/man/mlr_filters_information_gain.Rd @@ -45,7 +45,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -86,10 +86,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmi.Rd b/man/mlr_filters_jmi.Rd index c8ebb678..1ef760f1 100644 --- a/man/mlr_filters_jmi.Rd +++ b/man/mlr_filters_jmi.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmim.Rd b/man/mlr_filters_jmim.Rd index 08adcacd..a247eed0 100644 --- a/man/mlr_filters_jmim.Rd +++ b/man/mlr_filters_jmim.Rd @@ -53,7 +53,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -94,10 +94,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_kruskal_test.Rd b/man/mlr_filters_kruskal_test.Rd index ea400db9..7d9471e2 100644 --- a/man/mlr_filters_kruskal_test.Rd +++ b/man/mlr_filters_kruskal_test.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mim.Rd b/man/mlr_filters_mim.Rd index 9c019e85..b5c3332f 100644 --- a/man/mlr_filters_mim.Rd +++ b/man/mlr_filters_mim.Rd @@ -54,7 +54,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mrmr.Rd b/man/mlr_filters_mrmr.Rd index a1b7e70c..5a9a6d60 100644 --- a/man/mlr_filters_mrmr.Rd +++ b/man/mlr_filters_mrmr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_njmim.Rd b/man/mlr_filters_njmim.Rd index 5876cf48..d14dc237 100644 --- a/man/mlr_filters_njmim.Rd +++ b/man/mlr_filters_njmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_performance.Rd b/man/mlr_filters_performance.Rd index 2bda3bf2..d1696b35 100644 --- a/man/mlr_filters_performance.Rd +++ b/man/mlr_filters_performance.Rd @@ -30,7 +30,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_permutation.Rd b/man/mlr_filters_permutation.Rd index 3b55ffe7..62c44fa0 100644 --- a/man/mlr_filters_permutation.Rd +++ b/man/mlr_filters_permutation.Rd @@ -43,7 +43,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_relief.Rd b/man/mlr_filters_relief.Rd index ccd2d304..e09f14ad 100644 --- a/man/mlr_filters_relief.Rd +++ b/man/mlr_filters_relief.Rd @@ -30,7 +30,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -71,10 +71,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_selected_features.Rd b/man/mlr_filters_selected_features.Rd index c42dbc33..f644b21e 100644 --- a/man/mlr_filters_selected_features.Rd +++ b/man/mlr_filters_selected_features.Rd @@ -25,7 +25,7 @@ as.data.table(filter) } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -74,10 +74,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_variance.Rd b/man/mlr_filters_variance.Rd index 9200bd2e..0e9f67e0 100644 --- a/man/mlr_filters_variance.Rd +++ b/man/mlr_filters_variance.Rd @@ -36,7 +36,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -77,10 +77,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} From 52071484e6a787307d95a1711475ded9071a5cf3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Aug 2022 10:44:23 +0000 Subject: [PATCH 09/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- man/mlr_filters_anova.Rd | 10 +++++----- man/mlr_filters_auc.Rd | 10 +++++----- man/mlr_filters_carscore.Rd | 10 +++++----- man/mlr_filters_cmim.Rd | 10 +++++----- man/mlr_filters_correlation.Rd | 10 +++++----- man/mlr_filters_disr.Rd | 10 +++++----- man/mlr_filters_find_correlation.Rd | 10 +++++----- man/mlr_filters_importance.Rd | 10 +++++----- man/mlr_filters_information_gain.Rd | 10 +++++----- man/mlr_filters_jmi.Rd | 10 +++++----- man/mlr_filters_jmim.Rd | 10 +++++----- man/mlr_filters_kruskal_test.Rd | 10 +++++----- man/mlr_filters_mim.Rd | 10 +++++----- man/mlr_filters_mrmr.Rd | 10 +++++----- man/mlr_filters_njmim.Rd | 10 +++++----- man/mlr_filters_performance.Rd | 10 +++++----- man/mlr_filters_permutation.Rd | 10 +++++----- man/mlr_filters_relief.Rd | 10 +++++----- man/mlr_filters_selected_features.Rd | 10 +++++----- man/mlr_filters_variance.Rd | 10 +++++----- 20 files changed, 100 insertions(+), 100 deletions(-) diff --git a/man/mlr_filters_anova.Rd b/man/mlr_filters_anova.Rd index 498719af..0a169780 100644 --- a/man/mlr_filters_anova.Rd +++ b/man/mlr_filters_anova.Rd @@ -41,7 +41,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_auc.Rd b/man/mlr_filters_auc.Rd index 6cb41fc1..f46d27cb 100644 --- a/man/mlr_filters_auc.Rd +++ b/man/mlr_filters_auc.Rd @@ -37,7 +37,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -78,10 +78,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_carscore.Rd b/man/mlr_filters_carscore.Rd index 260525f3..11b6e2c6 100644 --- a/man/mlr_filters_carscore.Rd +++ b/man/mlr_filters_carscore.Rd @@ -39,7 +39,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("care")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -80,10 +80,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_cmim.Rd b/man/mlr_filters_cmim.Rd index 11f48f6c..1bfdddfd 100644 --- a/man/mlr_filters_cmim.Rd +++ b/man/mlr_filters_cmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_correlation.Rd b/man/mlr_filters_correlation.Rd index bc42e9f4..03457318 100644 --- a/man/mlr_filters_correlation.Rd +++ b/man/mlr_filters_correlation.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_disr.Rd b/man/mlr_filters_disr.Rd index bd058adc..ae801b19 100644 --- a/man/mlr_filters_disr.Rd +++ b/man/mlr_filters_disr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_find_correlation.Rd b/man/mlr_filters_find_correlation.Rd index 1f586366..5378f731 100644 --- a/man/mlr_filters_find_correlation.Rd +++ b/man/mlr_filters_find_correlation.Rd @@ -41,7 +41,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_importance.Rd b/man/mlr_filters_importance.Rd index a9a664d0..e8f28628 100644 --- a/man/mlr_filters_importance.Rd +++ b/man/mlr_filters_importance.Rd @@ -35,7 +35,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -84,10 +84,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_information_gain.Rd b/man/mlr_filters_information_gain.Rd index 589793d7..95913078 100644 --- a/man/mlr_filters_information_gain.Rd +++ b/man/mlr_filters_information_gain.Rd @@ -45,7 +45,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -86,10 +86,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmi.Rd b/man/mlr_filters_jmi.Rd index 1ef760f1..c8ebb678 100644 --- a/man/mlr_filters_jmi.Rd +++ b/man/mlr_filters_jmi.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_jmim.Rd b/man/mlr_filters_jmim.Rd index a247eed0..08adcacd 100644 --- a/man/mlr_filters_jmim.Rd +++ b/man/mlr_filters_jmim.Rd @@ -53,7 +53,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -94,10 +94,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_kruskal_test.Rd b/man/mlr_filters_kruskal_test.Rd index 7d9471e2..ea400db9 100644 --- a/man/mlr_filters_kruskal_test.Rd +++ b/man/mlr_filters_kruskal_test.Rd @@ -40,7 +40,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -81,10 +81,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mim.Rd b/man/mlr_filters_mim.Rd index b5c3332f..9c019e85 100644 --- a/man/mlr_filters_mim.Rd +++ b/man/mlr_filters_mim.Rd @@ -54,7 +54,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_mrmr.Rd b/man/mlr_filters_mrmr.Rd index 5a9a6d60..a1b7e70c 100644 --- a/man/mlr_filters_mrmr.Rd +++ b/man/mlr_filters_mrmr.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_njmim.Rd b/man/mlr_filters_njmim.Rd index d14dc237..5876cf48 100644 --- a/man/mlr_filters_njmim.Rd +++ b/man/mlr_filters_njmim.Rd @@ -52,7 +52,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -93,10 +93,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_performance.Rd b/man/mlr_filters_performance.Rd index d1696b35..2bda3bf2 100644 --- a/man/mlr_filters_performance.Rd +++ b/man/mlr_filters_performance.Rd @@ -30,7 +30,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -82,10 +82,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_permutation.Rd b/man/mlr_filters_permutation.Rd index 62c44fa0..3b55ffe7 100644 --- a/man/mlr_filters_permutation.Rd +++ b/man/mlr_filters_permutation.Rd @@ -43,7 +43,7 @@ if (requireNamespace("mlr3pipelines")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -95,10 +95,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_relief.Rd b/man/mlr_filters_relief.Rd index e09f14ad..ccd2d304 100644 --- a/man/mlr_filters_relief.Rd +++ b/man/mlr_filters_relief.Rd @@ -30,7 +30,7 @@ if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -71,10 +71,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_selected_features.Rd b/man/mlr_filters_selected_features.Rd index f644b21e..c42dbc33 100644 --- a/man/mlr_filters_selected_features.Rd +++ b/man/mlr_filters_selected_features.Rd @@ -25,7 +25,7 @@ as.data.table(filter) } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -74,10 +74,10 @@ Learner to extract the importance values from.} \if{html}{\out{
Inherited methods
}} diff --git a/man/mlr_filters_variance.Rd b/man/mlr_filters_variance.Rd index 0e9f67e0..9200bd2e 100644 --- a/man/mlr_filters_variance.Rd +++ b/man/mlr_filters_variance.Rd @@ -36,7 +36,7 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). } \seealso{ \itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline +\item \link[mlr3pipelines:PipeOpFilter]{PipeOpFilter} for filtering in a pipeline \item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} } @@ -77,10 +77,10 @@ Other Filter: \if{html}{\out{
Inherited methods
}} From 681ed5b4fdebbd259c905f2a6ec8f7817eb4621f Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Tue, 16 Aug 2022 11:58:26 +0200 Subject: [PATCH 10/11] docs: improve filter docs --- DESCRIPTION | 3 +- NAMESPACE | 2 +- R/FilterAUC.R | 6 +- R/FilterAnova.R | 6 +- R/FilterCMIM.R | 8 +- R/FilterCarScore.R | 79 ------------------ R/FilterCorrelation.R | 6 +- R/FilterDISR.R | 8 +- R/FilterFindCorrelation.R | 7 +- R/FilterImportance.R | 10 ++- R/FilterInformationGain.R | 9 ++- R/FilterJMI.R | 8 +- R/FilterJMIM.R | 8 +- R/FilterKruskalTest.R | 6 +- R/FilterMIM.R | 9 ++- R/FilterMRMR.R | 8 +- R/FilterNJMIM.R | 8 +- R/FilterPerformance.R | 7 +- R/FilterPermutation.R | 6 +- R/FilterRelief.R | 8 +- R/FilterSelectedFeatures.R | 28 +++++-- R/FilterVariance.R | 6 +- R/rd_info.R | 9 +++ man-roxygen/filter.R | 14 ++++ man/Filter.Rd | 1 - man/mlr_filters.Rd | 1 - man/mlr_filters_anova.Rd | 28 ++++++- man/mlr_filters_auc.Rd | 28 ++++++- man/mlr_filters_carscore.Rd | 117 --------------------------- man/mlr_filters_cmim.Rd | 32 +++++++- man/mlr_filters_correlation.Rd | 31 ++++++- man/mlr_filters_disr.Rd | 32 +++++++- man/mlr_filters_find_correlation.Rd | 31 ++++++- man/mlr_filters_importance.Rd | 33 +++++++- man/mlr_filters_information_gain.Rd | 35 +++++++- man/mlr_filters_jmi.Rd | 32 +++++++- man/mlr_filters_jmim.Rd | 32 +++++++- man/mlr_filters_kruskal_test.Rd | 30 ++++++- man/mlr_filters_mim.Rd | 33 +++++++- man/mlr_filters_mrmr.Rd | 32 +++++++- man/mlr_filters_njmim.Rd | 32 +++++++- man/mlr_filters_performance.Rd | 30 ++++++- man/mlr_filters_permutation.Rd | 29 ++++++- man/mlr_filters_relief.Rd | 33 +++++++- man/mlr_filters_selected_features.Rd | 51 ++++++++++-- man/mlr_filters_variance.Rd | 30 ++++++- 46 files changed, 712 insertions(+), 290 deletions(-) delete mode 100644 R/FilterCarScore.R create mode 100644 R/rd_info.R create mode 100644 man-roxygen/filter.R delete mode 100644 man/mlr_filters_carscore.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 8524a0ec..d87c96cb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,7 +31,6 @@ Imports: Suggests: care, caret, - carSurv, FSelectorRcpp, knitr, lgr, @@ -54,7 +53,6 @@ Collate: 'FilterAUC.R' 'FilterAnova.R' 'FilterCMIM.R' - 'FilterCarScore.R' 'FilterCorrelation.R' 'FilterDISR.R' 'FilterFindCorrelation.R' @@ -74,5 +72,6 @@ Collate: 'bibentries.R' 'flt.R' 'helper.R' + 'rd_info.R' 'reexports.R' 'zzz.R' diff --git a/NAMESPACE b/NAMESPACE index b5c97f0b..6a88ce4d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,11 +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(FilterCorrelation) export(FilterDISR) export(FilterFindCorrelation) diff --git a/R/FilterAUC.R b/R/FilterAUC.R index dfa4b787..f3d9133e 100644 --- a/R/FilterAUC.R +++ b/R/FilterAUC.R @@ -14,6 +14,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id auc +#' @template filter #' @family Filter #' @template seealso_filter #' @export @@ -27,7 +29,9 @@ #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("auc"), filter.cutoff = 0.1) %>>% +#' # 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) diff --git a/R/FilterAnova.R b/R/FilterAnova.R index ab328c0e..60c9c3bb 100644 --- a/R/FilterAnova.R +++ b/R/FilterAnova.R @@ -14,6 +14,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id anova +#' @template filter #' @family Filter #' @importFrom stats aov #' @template seealso_filter @@ -31,7 +33,9 @@ #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("anova"), filter.cutoff = 20) %>>% +#' # 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) diff --git a/R/FilterCMIM.R b/R/FilterCMIM.R index 85beee61..d72fb4b3 100644 --- a/R/FilterCMIM.R +++ b/R/FilterCMIM.R @@ -14,6 +14,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id cmim +#' @template filter #' @template details_praznik #' @family Filter #' @template seealso_filter @@ -26,11 +28,13 @@ #' as.data.table(filter) #' } #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("cmim"), filter.cutoff = 0.5) %>>% +#' # 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) diff --git a/R/FilterCarScore.R b/R/FilterCarScore.R deleted file mode 100644 index 9a8645d1..00000000 --- a/R/FilterCarScore.R +++ /dev/null @@ -1,79 +0,0 @@ -#' @title Correlation-Adjusted Marignal Correlation Score Filter -#' -#' @name mlr_filters_carscore -#' -#' @description Calculates the Correlation-Adjusted (marginal) coRrelation scores -#' (short CAR scores) implemented in [care::carscore()] in package -#' \CRANpkg{care}. The CAR scores for a set of features are defined as the -#' correlations between the target and the decorrelated features. The filter -#' returns the absolute value of the calculated scores. -#' -#' Argument `verbose` defaults to `FALSE`. -#' -#' @family Filter -#' @template seealso_filter -#' @export -#' @examples -#' if (requireNamespace("care")) { -#' task = mlr3::tsk("mtcars") -#' filter = flt("carscore") -#' filter$calculate(task) -#' head(as.data.table(filter), 3) -#' } -#' -#' ## changing filter settings -#' filter = flt("carscore") -#' filter$param_set$values = list("diagonal" = TRUE) -#' filter$calculate(task) -#' head(as.data.table(filter), 3) -#' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("care")) { -#' library("mlr3pipelines") -#' task = mlr3::tsk("mtcars") -#' -#' graph = po("filter", filter = flt("carscore"), filter.cutoff = 0.2) %>>% -#' po("learner", mlr3::lrn("regr.rpart")) -#' -#' graph$train(task) -#' } -FilterCarScore = R6Class("FilterCarScore", - inherit = Filter, - - public = list( - #' @description Create a FilterCarScore object. - initialize = function() { - param_set = ps( - lambda = p_dbl(lower = 0, upper = 1, default = NO_DEF), - diagonal = p_lgl(default = FALSE), - verbose = p_lgl(default = TRUE) - ) - param_set$values = list(verbose = FALSE) - - super$initialize( - id = "carscore", - task_type = "regr", - param_set = param_set, - feature_types = "numeric", - packages = "care", - label = "Correlation-Adjusted coRrelation Score", - man = "mlr3filters::mlr_filters_carscore" - ) - } - ), - - private = list( - .calculate = function(task, nfeat) { - target = task$truth() - features = task$data(cols = task$feature_names) - - pv = self$param_set$values - scores = invoke(care::carscore, - Xtrain = features, Ytrain = target, - .args = pv) - set_names(abs(scores), names(scores)) - } - ) -) - -#' @include mlr_filters.R -mlr_filters$add("carscore", FilterCarScore) diff --git a/R/FilterCorrelation.R b/R/FilterCorrelation.R index 9c021735..839cc0d9 100644 --- a/R/FilterCorrelation.R +++ b/R/FilterCorrelation.R @@ -11,6 +11,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id correlation +#' @template filter #' @family Filter #' @template seealso_filter #' @export @@ -30,7 +32,9 @@ #' library("mlr3pipelines") #' task = mlr3::tsk("boston_housing") #' -#' graph = po("filter", filter = flt("correlation"), filter.cutoff = 0.2) %>>% +#' # 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) diff --git a/R/FilterDISR.R b/R/FilterDISR.R index 54f24424..19f297c9 100644 --- a/R/FilterDISR.R +++ b/R/FilterDISR.R @@ -14,6 +14,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id disr +#' @template filter #' @template details_praznik #' @family Filter #' @template seealso_filter @@ -26,11 +28,13 @@ #' as.data.table(filter) #' } #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("disr"), filter.cutoff = 0.2) %>>% +#' # 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) diff --git a/R/FilterFindCorrelation.R b/R/FilterFindCorrelation.R index 2e6c1eb5..18a54fcf 100644 --- a/R/FilterFindCorrelation.R +++ b/R/FilterFindCorrelation.R @@ -15,6 +15,9 @@ #' 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 @@ -34,7 +37,9 @@ #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("find_correlation"), filter.cutoff = 0.4) %>>% +#' # 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) diff --git a/R/FilterImportance.R b/R/FilterImportance.R index 3db9a826..a98c2a02 100644 --- a/R/FilterImportance.R +++ b/R/FilterImportance.R @@ -7,6 +7,9 @@ #' 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 @@ -19,15 +22,16 @@ #' as.data.table(filter) #' } #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && -#' requireNamespace("MASS")) { +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners", "MASS"), quietly = TRUE)) { #' library("mlr3learners") #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' #' learner = mlr3::lrn("classif.rpart") #' -#' graph = po("filter", filter = flt("importance", learner = learner), filter.cutoff = 100) %>>% +#' # 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) diff --git a/R/FilterInformationGain.R b/R/FilterInformationGain.R index b39cb1d8..06bc1263 100644 --- a/R/FilterInformationGain.R +++ b/R/FilterInformationGain.R @@ -11,6 +11,9 @@ #' Argument `equal` defaults to `FALSE` for classification tasks, and to #' `TRUE` for regression tasks. #' +#' @templateVar id information_gain +#' @template filter +#' #' @family Filter #' @template seealso_filter #' @export @@ -32,11 +35,13 @@ #' #' } #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "FSelectorRcpp"), quietly = TRUE)) { #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("information_gain"), filter.cutoff = 0.1) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("information_gain"), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterJMI.R b/R/FilterJMI.R index d0d18bdc..e604a219 100644 --- a/R/FilterJMI.R +++ b/R/FilterJMI.R @@ -14,6 +14,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id jmi +#' @template filter #' #' @template details_praznik #' @family Filter @@ -27,11 +29,13 @@ #' as.data.table(filter) #' } #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("jmi"), filter.cutoff = 0.2) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("jmi"), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterJMIM.R b/R/FilterJMIM.R index 94d4a22d..05468d88 100644 --- a/R/FilterJMIM.R +++ b/R/FilterJMIM.R @@ -14,6 +14,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id jmim +#' @template filter #' @template details_praznik #' @family Filter #' @template seealso_filter @@ -27,11 +29,13 @@ #' } #' #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("jmim"), filter.cutoff = 0.5) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("jmim"), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterKruskalTest.R b/R/FilterKruskalTest.R index 63daf2d1..ac31a8b5 100644 --- a/R/FilterKruskalTest.R +++ b/R/FilterKruskalTest.R @@ -13,6 +13,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id kruskal_test +#' @template filter #' @family Filter #' @importFrom stats kruskal.test #' @template seealso_filter @@ -30,7 +32,9 @@ #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("kruskal_test"), filter.cutoff = 0.2) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("kruskal_test"), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterMIM.R b/R/FilterMIM.R index 68742ebc..0f7c4633 100644 --- a/R/FilterMIM.R +++ b/R/FilterMIM.R @@ -14,12 +14,13 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id mim +#' @template filter #' @template details_praznik #' @family Filter #' @template seealso_filter #' @export #' @examples -#' #' if (requireNamespace("praznik")) { #' task = mlr3::tsk("iris") #' filter = flt("mim") @@ -28,11 +29,13 @@ #' } #' #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("mim"), filter.cutoff = 0.3) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("mim"), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterMRMR.R b/R/FilterMRMR.R index 24e68539..b7ecd74a 100644 --- a/R/FilterMRMR.R +++ b/R/FilterMRMR.R @@ -14,6 +14,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id mrmr +#' @template filter #' @template details_praznik #' @family Filter #' @template seealso_filter @@ -26,11 +28,13 @@ #' as.data.table(filter) #' } #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("mrmr"), filter.cutoff = 0.4) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("mrmr"), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterNJMIM.R b/R/FilterNJMIM.R index 34a8e38a..34c5ec72 100644 --- a/R/FilterNJMIM.R +++ b/R/FilterNJMIM.R @@ -14,6 +14,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id njmim +#' @template filter #' @template details_praznik #' @family Filter #' @template seealso_filter @@ -26,11 +28,13 @@ #' as.data.table(filter) #' } #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +#' if (mlr3misc::require_namespaces(c(c("mlr3pipelines", "praznik")), quietly = TRUE)) { #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("njmim"), filter.cutoff = 0.4) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("njmim"), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterPerformance.R b/R/FilterPerformance.R index 61b63ab1..2be9d4ec 100644 --- a/R/FilterPerformance.R +++ b/R/FilterPerformance.R @@ -8,6 +8,9 @@ #' [mlr3::Measure], or the negated aggregated performance if the measure has #' to be minimized. #' +#' @templateVar id performance +#' @template filter +#' #' @family Filter #' @template seealso_filter #' @export @@ -22,7 +25,9 @@ #' task = mlr3::tsk("spam") #' l = lrn("classif.rpart") #' -#' graph = po("filter", filter = flt("performance", learner = l), filter.cutoff = -0.3) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("performance", learner = l), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterPermutation.R b/R/FilterPermutation.R index 2092ef8b..726f1a3d 100644 --- a/R/FilterPermutation.R +++ b/R/FilterPermutation.R @@ -18,6 +18,8 @@ #' Number of Monte-Carlo iterations to use in computing the feature importance. #' } #' +#' @templateVar id permutation +#' @template filter #' @family Filter #' @template seealso_filter #' @export @@ -34,7 +36,9 @@ #' library("mlr3pipelines") #' task = mlr3::tsk("iris") #' -#' graph = po("filter", filter = flt("permutation", nmc = 2), filter.cutoff = 0.1) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("permutation", nmc = 2), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterRelief.R b/R/FilterRelief.R index 569e9fd2..0b921936 100644 --- a/R/FilterRelief.R +++ b/R/FilterRelief.R @@ -5,6 +5,8 @@ #' @description Information gain filter calling #' [FSelectorRcpp::relief()] in package \CRANpkg{FSelectorRcpp}. #' +#' @templateVar id relief +#' @template filter #' @family Filter #' @template seealso_filter #' @export @@ -18,11 +20,13 @@ #' as.data.table(filter) #' } #' -#' if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "FSelectorRcpp"), quietly = TRUE)) { #' library("mlr3pipelines") #' task = mlr3::tsk("iris") #' -#' graph = po("filter", filter = flt("relief"), filter.cutoff = 0.15) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("relief"), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/FilterSelectedFeatures.R b/R/FilterSelectedFeatures.R index f8ea66fa..6dfef9a5 100644 --- a/R/FilterSelectedFeatures.R +++ b/R/FilterSelectedFeatures.R @@ -14,16 +14,33 @@ #' different from the order in the learner. In combination with #' \CRANpkg{mlr3pipelines}, only the filter criterion `cutoff` makes sense. #' +#' @templateVar id selected_features +#' @template filter #' #' @family Filter #' @template seealso_filter #' @export #' @examples -#' task = mlr3::tsk("iris") -#' learner = mlr3::lrn("classif.rpart") -#' filter = flt("selected_features", learner = learner) -#' filter$calculate(task) -#' as.data.table(filter) +#' if (requireNamespace("MASS")) { +#' task = mlr3::tsk("iris") +#' learner = mlr3::lrn("classif.rpart") +#' filter = flt("selected_features", learner = learner) +#' filter$calculate(task) +#' as.data.table(filter) +#' } +#' +#' if (mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners"), quietly = TRUE)) { +#' library("mlr3pipelines") +#' library("mlr3learners") +#' task = mlr3::tsk("spam") +#' +#' filter = flt("selected_features", learner = lrn("classif.rpart")) +#' +#' graph = po("filter", filter = filter) %>>% +#' po("learner", mlr3::lrn("classif.log_reg")) +#' +#' graph$train(task) +#' } FilterSelectedFeatures = R6Class("FilterSelectedFeatures", inherit = Filter, @@ -65,3 +82,4 @@ FilterSelectedFeatures = R6Class("FilterSelectedFeatures", #' @include mlr_filters.R mlr_filters$add("selected_features", FilterSelectedFeatures) + diff --git a/R/FilterVariance.R b/R/FilterVariance.R index 8fccb335..b2b37fc8 100644 --- a/R/FilterVariance.R +++ b/R/FilterVariance.R @@ -11,6 +11,8 @@ #' #' `r format_bib("bommert_2020")` #' +#' @templateVar id variance +#' @template filter #' @family Filter #' @importFrom stats var #' @template seealso_filter @@ -26,7 +28,9 @@ #' library("mlr3pipelines") #' task = mlr3::tsk("spam") #' -#' graph = po("filter", filter = flt("variance"), filter.cutoff = 1) %>>% +#' # Note: The filter.frac is selected randomly and should be tuned. +#' +#' graph = po("filter", filter = flt("variance"), filter.frac = 0.5) %>>% #' po("learner", mlr3::lrn("classif.rpart")) #' #' graph$train(task) diff --git a/R/rd_info.R b/R/rd_info.R new file mode 100644 index 00000000..e3b3b060 --- /dev/null +++ b/R/rd_info.R @@ -0,0 +1,9 @@ +#' @export +rd_info.Filter = function(obj, section) { # nolint + x = c("", + sprintf("* Task types: %s", rd_format_string(obj$task_type)), + sprintf("* Feature types: %s", rd_format_string(obj$feature_types)), + sprintf("* Packages: %s", rd_format_string(obj$packages)) + ) + paste(x, collapse = "\n") +} diff --git a/man-roxygen/filter.R b/man-roxygen/filter.R new file mode 100644 index 00000000..b1f4e356 --- /dev/null +++ b/man-roxygen/filter.R @@ -0,0 +1,14 @@ +#' @section Dictionary: +#' This [Learner] can be instantiated via the [dictionary][mlr3misc::Dictionary] [mlr_filters] or with the associated sugar function [flt()]: +#' ``` +#' mlr_filters$get("<%= id %>") +#' flt("<%= id %>") +#' ``` +#' +#' @section Meta Information: +#' `r mlr3misc::rd_info(mlr3filters::flt("<%= id %>"))` +#' @md +#' +#' @section Parameters: +#' `r mlr3misc::rd_info(mlr3filters::flt("<%= id %>")$param_set)` +#' @md diff --git a/man/Filter.Rd b/man/Filter.Rd index 05e1b5b6..25d755ab 100644 --- a/man/Filter.Rd +++ b/man/Filter.Rd @@ -20,7 +20,6 @@ and then get a score value of \code{NA}. Other Filter: \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters.Rd b/man/mlr_filters.Rd index f489f5a5..7517c007 100644 --- a/man/mlr_filters.Rd +++ b/man/mlr_filters.Rd @@ -35,7 +35,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_anova.Rd b/man/mlr_filters_anova.Rd index 498719af..e26e228a 100644 --- a/man/mlr_filters_anova.Rd +++ b/man/mlr_filters_anova.Rd @@ -12,6 +12,29 @@ The filter value is \code{-log10(p)} where \code{p} is the \eqn{p}-value. This transformation is necessary to ensure numerical stability for very small \eqn{p}-values. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("anova") +flt("anova") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif} +\item Feature types: \dQuote{integer}, \dQuote{numeric} +\item Packages: \dQuote{mlr3filters}, \dQuote{stats} +} +} + +\section{Parameters}{ + +Empty ParamSet +} + \examples{ task = mlr3::tsk("iris") filter = flt("anova") @@ -25,7 +48,9 @@ if (requireNamespace("mlr3pipelines")) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("anova"), filter.cutoff = 20) \%>>\% + # 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) @@ -48,7 +73,6 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_auc.Rd b/man/mlr_filters_auc.Rd index 6cb41fc1..d6e3ecec 100644 --- a/man/mlr_filters_auc.Rd +++ b/man/mlr_filters_auc.Rd @@ -11,6 +11,29 @@ calculating the AUC. If the AUC is undefined for the input, it is set to 0.5 (random classifier). The absolute value of the difference between the AUC and 0.5 is used as final filter value. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("auc") +flt("auc") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif} +\item Feature types: \dQuote{integer}, \dQuote{numeric} +\item Packages: \dQuote{mlr3filters}, \dQuote{mlr3measures} +} +} + +\section{Parameters}{ + +Empty ParamSet +} + \examples{ task = mlr3::tsk("pima") filter = flt("auc") @@ -21,7 +44,9 @@ if (requireNamespace("mlr3pipelines")) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("auc"), filter.cutoff = 0.1) \%>>\% + # 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) @@ -44,7 +69,6 @@ Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_carscore.Rd b/man/mlr_filters_carscore.Rd deleted file mode 100644 index 260525f3..00000000 --- a/man/mlr_filters_carscore.Rd +++ /dev/null @@ -1,117 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FilterCarScore.R -\name{mlr_filters_carscore} -\alias{mlr_filters_carscore} -\alias{FilterCarScore} -\title{Correlation-Adjusted Marignal Correlation Score Filter} -\description{ -Calculates the Correlation-Adjusted (marginal) coRrelation scores -(short CAR scores) implemented in \code{\link[care:carscore]{care::carscore()}} in package -\CRANpkg{care}. The CAR scores for a set of features are defined as the -correlations between the target and the decorrelated features. The filter -returns the absolute value of the calculated scores. - -Argument \code{verbose} defaults to \code{FALSE}. -} -\examples{ -if (requireNamespace("care")) { - task = mlr3::tsk("mtcars") - filter = flt("carscore") - filter$calculate(task) - head(as.data.table(filter), 3) -} - -## changing filter settings -filter = flt("carscore") -filter$param_set$values = list("diagonal" = TRUE) -filter$calculate(task) -head(as.data.table(filter), 3) - -if (requireNamespace("mlr3pipelines") && requireNamespace("care")) { - library("mlr3pipelines") - task = mlr3::tsk("mtcars") - - graph = po("filter", filter = flt("carscore"), filter.cutoff = 0.2) \%>>\% - po("learner", mlr3::lrn("regr.rpart")) - - graph$train(task) -} -} -\seealso{ -\itemize{ -\item \link[mlr3pipelines:mlr_pipeops_filter]{PipeOpFilter} for filtering in a pipeline -\item \link[mlr3misc:Dictionary]{Dictionary} of \link[=Filter]{Filters}: \link{mlr_filters} -} - -Other Filter: -\code{\link{Filter}}, -\code{\link{mlr_filters_anova}}, -\code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_cmim}}, -\code{\link{mlr_filters_correlation}}, -\code{\link{mlr_filters_disr}}, -\code{\link{mlr_filters_find_correlation}}, -\code{\link{mlr_filters_importance}}, -\code{\link{mlr_filters_information_gain}}, -\code{\link{mlr_filters_jmim}}, -\code{\link{mlr_filters_jmi}}, -\code{\link{mlr_filters_kruskal_test}}, -\code{\link{mlr_filters_mim}}, -\code{\link{mlr_filters_mrmr}}, -\code{\link{mlr_filters_njmim}}, -\code{\link{mlr_filters_performance}}, -\code{\link{mlr_filters_permutation}}, -\code{\link{mlr_filters_relief}}, -\code{\link{mlr_filters_selected_features}}, -\code{\link{mlr_filters_variance}}, -\code{\link{mlr_filters}} -} -\concept{Filter} -\section{Super class}{ -\code{\link[mlr3filters:Filter]{mlr3filters::Filter}} -> \code{FilterCarScore} -} -\section{Methods}{ -\subsection{Public methods}{ -\itemize{ -\item \href{#method-FilterCarScore-new}{\code{FilterCarScore$new()}} -\item \href{#method-FilterCarScore-clone}{\code{FilterCarScore$clone()}} -} -} -\if{html}{\out{ -
Inherited methods - -
-}} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-FilterCarScore-new}{}}} -\subsection{Method \code{new()}}{ -Create a FilterCarScore object. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{FilterCarScore$new()}\if{html}{\out{
}} -} - -} -\if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-FilterCarScore-clone}{}}} -\subsection{Method \code{clone()}}{ -The objects of this class are cloneable with this method. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{FilterCarScore$clone(deep = FALSE)}\if{html}{\out{
}} -} - -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{deep}}{Whether to make a deep clone.} -} -\if{html}{\out{
}} -} -} -} diff --git a/man/mlr_filters_cmim.Rd b/man/mlr_filters_cmim.Rd index 11f48f6c..75cf1241 100644 --- a/man/mlr_filters_cmim.Rd +++ b/man/mlr_filters_cmim.Rd @@ -19,6 +19,31 @@ Threading is disabled by default (hyperparameter \code{threads} is set to 1). Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecting the number of available cores. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("cmim") +flt("cmim") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric}, \dQuote{factor}, \dQuote{ordered} +\item Packages: \dQuote{mlr3filters}, \dQuote{praznik} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Range \cr + threads \tab integer \tab 0 \tab \eqn{[0, \infty)}{[0, Inf)} \cr +} +} + \examples{ if (requireNamespace("praznik")) { task = mlr3::tsk("iris") @@ -27,11 +52,13 @@ if (requireNamespace("praznik")) { as.data.table(filter) } -if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("cmim"), filter.cutoff = 0.5) \%>>\% + # 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) @@ -60,7 +87,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, \code{\link{mlr_filters_find_correlation}}, diff --git a/man/mlr_filters_correlation.Rd b/man/mlr_filters_correlation.Rd index bc42e9f4..672fb846 100644 --- a/man/mlr_filters_correlation.Rd +++ b/man/mlr_filters_correlation.Rd @@ -8,6 +8,32 @@ Simple correlation filter calling \code{\link[stats:cor]{stats::cor()}}. The filter score is the absolute value of the correlation. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("correlation") +flt("correlation") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric} +\item Packages: \dQuote{mlr3filters}, \dQuote{stats} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Levels \cr + use \tab character \tab everything \tab everything, all.obs, complete.obs, na.or.complete, pairwise.complete.obs \cr + method \tab character \tab pearson \tab pearson, kendall, spearman \cr +} +} + \examples{ ## Pearson (default) task = mlr3::tsk("mtcars") @@ -24,7 +50,9 @@ if (requireNamespace("mlr3pipelines")) { library("mlr3pipelines") task = mlr3::tsk("boston_housing") - graph = po("filter", filter = flt("correlation"), filter.cutoff = 0.2) \%>>\% + # 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) @@ -48,7 +76,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_disr}}, \code{\link{mlr_filters_find_correlation}}, diff --git a/man/mlr_filters_disr.Rd b/man/mlr_filters_disr.Rd index bd058adc..13aa9c1c 100644 --- a/man/mlr_filters_disr.Rd +++ b/man/mlr_filters_disr.Rd @@ -19,6 +19,31 @@ Threading is disabled by default (hyperparameter \code{threads} is set to 1). Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecting the number of available cores. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("disr") +flt("disr") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric}, \dQuote{factor}, \dQuote{ordered} +\item Packages: \dQuote{mlr3filters}, \dQuote{praznik} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Range \cr + threads \tab integer \tab 0 \tab \eqn{[0, \infty)}{[0, Inf)} \cr +} +} + \examples{ if (requireNamespace("praznik")) { task = mlr3::tsk("iris") @@ -27,11 +52,13 @@ if (requireNamespace("praznik")) { as.data.table(filter) } -if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("disr"), filter.cutoff = 0.2) \%>>\% + # 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) @@ -60,7 +87,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_find_correlation}}, diff --git a/man/mlr_filters_find_correlation.Rd b/man/mlr_filters_find_correlation.Rd index 1f586366..7af96714 100644 --- a/man/mlr_filters_find_correlation.Rd +++ b/man/mlr_filters_find_correlation.Rd @@ -17,6 +17,32 @@ with the way other filters work. Subsequently \code{caret::findCorrelation(cutoff = 0.9)} lists the same features that are excluded with \code{FilterFindCorrelation} at score 0.1 (= 1 - 0.9). } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("find_correlation") +flt("find_correlation") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric} +\item Packages: \dQuote{mlr3filters}, \dQuote{stats} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Levels \cr + use \tab character \tab everything \tab everything, all.obs, complete.obs, na.or.complete, pairwise.complete.obs \cr + method \tab character \tab pearson \tab pearson, kendall, spearman \cr +} +} + \examples{ # Pearson (default) task = mlr3::tsk("mtcars") @@ -33,7 +59,9 @@ if (requireNamespace("mlr3pipelines")) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("find_correlation"), filter.cutoff = 0.4) \%>>\% + # 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) @@ -49,7 +77,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_importance.Rd b/man/mlr_filters_importance.Rd index a9a664d0..a086c357 100644 --- a/man/mlr_filters_importance.Rd +++ b/man/mlr_filters_importance.Rd @@ -10,6 +10,31 @@ machine learning algorithms. Takes a \link[mlr3:Learner]{mlr3::Learner} which is extracting the variable importance (property "importance"), fits the model and extracts the importance values to use as filter scores. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("importance") +flt("importance") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif} +\item Feature types: \dQuote{logical}, \dQuote{integer}, \dQuote{numeric}, \dQuote{character}, \dQuote{factor}, \dQuote{ordered}, \dQuote{POSIXct} +\item Packages: \dQuote{mlr3filters}, \dQuote{mlr3} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Levels \cr + method \tab character \tab mode \tab mode, sample, weighted.sample \cr +} +} + \examples{ if (requireNamespace("MASS")) { task = mlr3::tsk("iris") @@ -19,15 +44,16 @@ if (requireNamespace("MASS")) { as.data.table(filter) } -if (requireNamespace("mlr3pipelines") && requireNamespace("mlr3learners") && - requireNamespace("MASS")) { +if (mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners", "MASS"), quietly = TRUE)) { library("mlr3learners") library("mlr3pipelines") task = mlr3::tsk("spam") learner = mlr3::lrn("classif.rpart") - graph = po("filter", filter = flt("importance", learner = learner), filter.cutoff = 100) \%>>\% + # 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) @@ -43,7 +69,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_information_gain.Rd b/man/mlr_filters_information_gain.Rd index 589793d7..eb334202 100644 --- a/man/mlr_filters_information_gain.Rd +++ b/man/mlr_filters_information_gain.Rd @@ -14,6 +14,34 @@ parameter \code{"type"} to \code{"gainratio"} to calculate the gain ratio, or se Argument \code{equal} defaults to \code{FALSE} for classification tasks, and to \code{TRUE} for regression tasks. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("information_gain") +flt("information_gain") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric}, \dQuote{factor}, \dQuote{ordered} +\item Packages: \dQuote{mlr3filters}, \dQuote{FSelectorRcpp} +} +} + +\section{Parameters}{ +\tabular{lllll}{ + Id \tab Type \tab Default \tab Levels \tab Range \cr + type \tab character \tab infogain \tab infogain, gainratio, symuncert \tab - \cr + equal \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr + discIntegers \tab logical \tab TRUE \tab TRUE, FALSE \tab - \cr + threads \tab integer \tab 0 \tab \tab \eqn{[0, \infty)}{[0, Inf)} \cr +} +} + \examples{ if (requireNamespace("FSelectorRcpp")) { ## InfoGain (default) @@ -32,11 +60,13 @@ if (requireNamespace("FSelectorRcpp")) { } -if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { +if (mlr3misc::require_namespaces(c("mlr3pipelines", "FSelectorRcpp"), quietly = TRUE)) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("information_gain"), filter.cutoff = 0.1) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("information_gain"), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -53,7 +83,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_jmi.Rd b/man/mlr_filters_jmi.Rd index 1ef760f1..af2b707e 100644 --- a/man/mlr_filters_jmi.Rd +++ b/man/mlr_filters_jmi.Rd @@ -19,6 +19,31 @@ Threading is disabled by default (hyperparameter \code{threads} is set to 1). Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecting the number of available cores. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("jmi") +flt("jmi") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric}, \dQuote{factor}, \dQuote{ordered} +\item Packages: \dQuote{mlr3filters}, \dQuote{praznik} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Range \cr + threads \tab integer \tab 0 \tab \eqn{[0, \infty)}{[0, Inf)} \cr +} +} + \examples{ if (requireNamespace("praznik")) { task = mlr3::tsk("iris") @@ -27,11 +52,13 @@ if (requireNamespace("praznik")) { as.data.table(filter) } -if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("jmi"), filter.cutoff = 0.2) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("jmi"), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -60,7 +87,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_jmim.Rd b/man/mlr_filters_jmim.Rd index a247eed0..2188989e 100644 --- a/man/mlr_filters_jmim.Rd +++ b/man/mlr_filters_jmim.Rd @@ -19,6 +19,31 @@ Threading is disabled by default (hyperparameter \code{threads} is set to 1). Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecting the number of available cores. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("jmim") +flt("jmim") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric}, \dQuote{factor}, \dQuote{ordered} +\item Packages: \dQuote{mlr3filters}, \dQuote{praznik} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Range \cr + threads \tab integer \tab 0 \tab \eqn{[0, \infty)}{[0, Inf)} \cr +} +} + \examples{ if (requireNamespace("praznik")) { task = mlr3::tsk("iris") @@ -28,11 +53,13 @@ if (requireNamespace("praznik")) { } -if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("jmim"), filter.cutoff = 0.5) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("jmim"), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -61,7 +88,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_kruskal_test.Rd b/man/mlr_filters_kruskal_test.Rd index 7d9471e2..908de055 100644 --- a/man/mlr_filters_kruskal_test.Rd +++ b/man/mlr_filters_kruskal_test.Rd @@ -11,6 +11,31 @@ The filter value is \code{-log10(p)} where \code{p} is the \eqn{p}-value. This transformation is necessary to ensure numerical stability for very small \eqn{p}-values. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("kruskal_test") +flt("kruskal_test") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif} +\item Feature types: \dQuote{integer}, \dQuote{numeric} +\item Packages: \dQuote{mlr3filters}, \dQuote{stats} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Levels \cr + na.action \tab character \tab na.omit \tab na.omit, na.fail, na.exclude, na.pass \cr +} +} + \examples{ task = mlr3::tsk("iris") filter = flt("kruskal_test") @@ -24,7 +49,9 @@ if (requireNamespace("mlr3pipelines")) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("kruskal_test"), filter.cutoff = 0.2) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("kruskal_test"), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -48,7 +75,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_mim.Rd b/man/mlr_filters_mim.Rd index b5c3332f..8a1c3098 100644 --- a/man/mlr_filters_mim.Rd +++ b/man/mlr_filters_mim.Rd @@ -19,8 +19,32 @@ Threading is disabled by default (hyperparameter \code{threads} is set to 1). Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecting the number of available cores. } -\examples{ +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("mim") +flt("mim") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric}, \dQuote{factor}, \dQuote{ordered} +\item Packages: \dQuote{mlr3filters}, \dQuote{praznik} +} +} +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Range \cr + threads \tab integer \tab 0 \tab \eqn{[0, \infty)}{[0, Inf)} \cr +} +} + +\examples{ if (requireNamespace("praznik")) { task = mlr3::tsk("iris") filter = flt("mim") @@ -29,11 +53,13 @@ if (requireNamespace("praznik")) { } -if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("mim"), filter.cutoff = 0.3) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("mim"), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -62,7 +88,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_mrmr.Rd b/man/mlr_filters_mrmr.Rd index 5a9a6d60..242ae1e6 100644 --- a/man/mlr_filters_mrmr.Rd +++ b/man/mlr_filters_mrmr.Rd @@ -19,6 +19,31 @@ Threading is disabled by default (hyperparameter \code{threads} is set to 1). Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecting the number of available cores. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("mrmr") +flt("mrmr") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric}, \dQuote{factor}, \dQuote{ordered} +\item Packages: \dQuote{mlr3filters}, \dQuote{praznik} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Range \cr + threads \tab integer \tab 0 \tab \eqn{[0, \infty)}{[0, Inf)} \cr +} +} + \examples{ if (requireNamespace("praznik")) { task = mlr3::tsk("iris") @@ -27,11 +52,13 @@ if (requireNamespace("praznik")) { as.data.table(filter) } -if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +if (mlr3misc::require_namespaces(c("mlr3pipelines", "praznik"), quietly = TRUE)) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("mrmr"), filter.cutoff = 0.4) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("mrmr"), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -60,7 +87,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_njmim.Rd b/man/mlr_filters_njmim.Rd index d14dc237..61daeea5 100644 --- a/man/mlr_filters_njmim.Rd +++ b/man/mlr_filters_njmim.Rd @@ -19,6 +19,31 @@ Threading is disabled by default (hyperparameter \code{threads} is set to 1). Set to a number \verb{>= 2} to enable threading, or to \code{0} for auto-detecting the number of available cores. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("njmim") +flt("njmim") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric}, \dQuote{factor}, \dQuote{ordered} +\item Packages: \dQuote{mlr3filters}, \dQuote{praznik} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Range \cr + threads \tab integer \tab 0 \tab \eqn{[0, \infty)}{[0, Inf)} \cr +} +} + \examples{ if (requireNamespace("praznik")) { task = mlr3::tsk("iris") @@ -27,11 +52,13 @@ if (requireNamespace("praznik")) { as.data.table(filter) } -if (requireNamespace("mlr3pipelines") && requireNamespace("praznik")) { +if (mlr3misc::require_namespaces(c(c("mlr3pipelines", "praznik")), quietly = TRUE)) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("njmim"), filter.cutoff = 0.4) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("njmim"), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -60,7 +87,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_performance.Rd b/man/mlr_filters_performance.Rd index d1696b35..154c8eba 100644 --- a/man/mlr_filters_performance.Rd +++ b/man/mlr_filters_performance.Rd @@ -11,6 +11,31 @@ feature separately. The filter score is the aggregated performance of the \link[mlr3:Measure]{mlr3::Measure}, or the negated aggregated performance if the measure has to be minimized. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("performance") +flt("performance") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif} +\item Feature types: \dQuote{logical}, \dQuote{integer}, \dQuote{numeric}, \dQuote{character}, \dQuote{factor}, \dQuote{ordered}, \dQuote{POSIXct} +\item Packages: \dQuote{mlr3filters}, \dQuote{mlr3}, \dQuote{mlr3measures} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Levels \cr + method \tab character \tab mode \tab mode, sample, weighted.sample \cr +} +} + \examples{ task = mlr3::tsk("iris") learner = mlr3::lrn("classif.rpart") @@ -22,7 +47,9 @@ if (requireNamespace("mlr3pipelines")) { task = mlr3::tsk("spam") l = lrn("classif.rpart") - graph = po("filter", filter = flt("performance", learner = l), filter.cutoff = -0.3) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("performance", learner = l), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -38,7 +65,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_permutation.Rd b/man/mlr_filters_permutation.Rd index 62c44fa0..195f9557 100644 --- a/man/mlr_filters_permutation.Rd +++ b/man/mlr_filters_permutation.Rd @@ -20,6 +20,30 @@ Standardize feature importance by maximum score.} \item{\code{nmc}}{\code{integer(1)}}\cr Number of Monte-Carlo iterations to use in computing the feature importance. } + +\tabular{lllll}{ + Id \tab Type \tab Default \tab Levels \tab Range \cr + standardize \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr + nmc \tab integer \tab 50 \tab \tab \eqn{[1, \infty)}{[1, Inf)} \cr +} +} + +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("permutation") +flt("permutation") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif} +\item Feature types: \dQuote{logical}, \dQuote{integer}, \dQuote{numeric}, \dQuote{character}, \dQuote{factor}, \dQuote{ordered}, \dQuote{POSIXct} +\item Packages: \dQuote{mlr3filters}, \dQuote{mlr3}, \dQuote{mlr3measures} +} } \examples{ @@ -35,7 +59,9 @@ if (requireNamespace("mlr3pipelines")) { library("mlr3pipelines") task = mlr3::tsk("iris") - graph = po("filter", filter = flt("permutation", nmc = 2), filter.cutoff = 0.1) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("permutation", nmc = 2), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -51,7 +77,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_relief.Rd b/man/mlr_filters_relief.Rd index e09f14ad..4f4e51b7 100644 --- a/man/mlr_filters_relief.Rd +++ b/man/mlr_filters_relief.Rd @@ -8,6 +8,32 @@ Information gain filter calling \code{\link[FSelectorRcpp:relief]{FSelectorRcpp::relief()}} in package \CRANpkg{FSelectorRcpp}. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("relief") +flt("relief") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif}, \dQuote{regr} +\item Feature types: \dQuote{integer}, \dQuote{numeric}, \dQuote{factor}, \dQuote{ordered} +\item Packages: \dQuote{mlr3filters}, \dQuote{FSelectorRcpp} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Range \cr + neighboursCount \tab integer \tab 5 \tab \eqn{[1, \infty)}{[1, Inf)} \cr + sampleSize \tab integer \tab 10 \tab \eqn{[1, \infty)}{[1, Inf)} \cr +} +} + \examples{ if (requireNamespace("FSelectorRcpp")) { ## Relief (default) @@ -18,11 +44,13 @@ if (requireNamespace("FSelectorRcpp")) { as.data.table(filter) } -if (requireNamespace("mlr3pipelines") && requireNamespace("FSelectorRcpp")) { +if (mlr3misc::require_namespaces(c("mlr3pipelines", "FSelectorRcpp"), quietly = TRUE)) { library("mlr3pipelines") task = mlr3::tsk("iris") - graph = po("filter", filter = flt("relief"), filter.cutoff = 0.15) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("relief"), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -38,7 +66,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_selected_features.Rd b/man/mlr_filters_selected_features.Rd index f644b21e..bc205de1 100644 --- a/man/mlr_filters_selected_features.Rd +++ b/man/mlr_filters_selected_features.Rd @@ -16,12 +16,52 @@ features get a score of 0. The order of selected features is random and different from the order in the learner. In combination with \CRANpkg{mlr3pipelines}, only the filter criterion \code{cutoff} makes sense. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("selected_features") +flt("selected_features") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{classif} +\item Feature types: \dQuote{logical}, \dQuote{integer}, \dQuote{numeric}, \dQuote{character}, \dQuote{factor}, \dQuote{ordered}, \dQuote{POSIXct} +\item Packages: \dQuote{mlr3filters}, \dQuote{mlr3} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Levels \cr + method \tab character \tab mode \tab mode, sample, weighted.sample \cr +} +} + \examples{ -task = mlr3::tsk("iris") -learner = mlr3::lrn("classif.rpart") -filter = flt("selected_features", learner = learner) -filter$calculate(task) -as.data.table(filter) +if (requireNamespace("MASS")) { + task = mlr3::tsk("iris") + learner = mlr3::lrn("classif.rpart") + filter = flt("selected_features", learner = learner) + filter$calculate(task) + as.data.table(filter) +} + +if (mlr3misc::require_namespaces(c("mlr3pipelines", "mlr3learners"), quietly = TRUE)) { + library("mlr3pipelines") + library("mlr3learners") + task = mlr3::tsk("spam") + + filter = flt("selected_features", learner = lrn("classif.rpart")) + + graph = po("filter", filter = filter) \%>>\% + po("learner", mlr3::lrn("classif.log_reg")) + + graph$train(task) +} } \seealso{ \itemize{ @@ -33,7 +73,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, diff --git a/man/mlr_filters_variance.Rd b/man/mlr_filters_variance.Rd index 0e9f67e0..69f1ad6e 100644 --- a/man/mlr_filters_variance.Rd +++ b/man/mlr_filters_variance.Rd @@ -9,6 +9,31 @@ Variance filter calling \code{stats::var()}. Argument \code{na.rm} defaults to \code{TRUE} here. } +\section{Dictionary}{ + +This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_filters} or with the associated sugar function \code{\link[=flt]{flt()}}: + +\if{html}{\out{
}}\preformatted{mlr_filters$get("variance") +flt("variance") +}\if{html}{\out{
}} +} + +\section{Meta Information}{ + +\itemize{ +\item Task types: \dQuote{NA} +\item Feature types: \dQuote{integer}, \dQuote{numeric} +\item Packages: \dQuote{mlr3filters}, \dQuote{stats} +} +} + +\section{Parameters}{ +\tabular{llll}{ + Id \tab Type \tab Default \tab Levels \cr + na.rm \tab logical \tab TRUE \tab TRUE, FALSE \cr +} +} + \examples{ task = mlr3::tsk("mtcars") filter = flt("variance") @@ -20,7 +45,9 @@ if (requireNamespace("mlr3pipelines")) { library("mlr3pipelines") task = mlr3::tsk("spam") - graph = po("filter", filter = flt("variance"), filter.cutoff = 1) \%>>\% + # Note: The filter.frac is selected randomly and should be tuned. + + graph = po("filter", filter = flt("variance"), filter.frac = 0.5) \%>>\% po("learner", mlr3::lrn("classif.rpart")) graph$train(task) @@ -44,7 +71,6 @@ Other Filter: \code{\link{Filter}}, \code{\link{mlr_filters_anova}}, \code{\link{mlr_filters_auc}}, -\code{\link{mlr_filters_carscore}}, \code{\link{mlr_filters_cmim}}, \code{\link{mlr_filters_correlation}}, \code{\link{mlr_filters_disr}}, From 70f95733c33e4c81dd54439c5a314c7f434f2969 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Tue, 16 Aug 2022 12:14:53 +0200 Subject: [PATCH 11/11] add survival filter --- R/FilterCarSurvScore.R | 58 +++++++++++++++++++++++++++++++ tests/testthat/test_filter_surv.R | 17 +++++++++ 2 files changed, 75 insertions(+) create mode 100644 R/FilterCarSurvScore.R create mode 100644 tests/testthat/test_filter_surv.R diff --git a/R/FilterCarSurvScore.R b/R/FilterCarSurvScore.R new file mode 100644 index 00000000..d880f260 --- /dev/null +++ b/R/FilterCarSurvScore.R @@ -0,0 +1,58 @@ +#' @title Correlation-Adjusted Survival Score Filter +#' +#' @name mlr_filters_carsurvscore +#' +#' @description Calculates CARS scores for right-censored survival tasks. +#' Calls the implementation in [carSurv::carSurvScore()] in package +#' \CRANpkg{carSurv}. +#' +#' @references +#' `r format_bib("bommert_2021")` +#' +#' @templateVar id surv.carfsurvscore +#' @template filter +#' @family Filter +#' @template seealso_filter +#' @export +FilterCarSurvScore = R6Class("FilterCarSurvScore", + inherit = Filter, + + public = list( + #' @description Create a FilterCarSurvScore object. + initialize = function() { + ps = ps( + maxIPCweight = p_int(lower = 0, default = 10), + denom = p_fct(c("1/n", "sum_w"), default = "1/n") + ) + super$initialize( + id = "surv.carsurvscore", + packages = c("carSurv", "mlr3proba"), + param_set = ps, + feature_types = c("integer", "numeric"), + task_type = "surv", + label = "Correlation-Adjusted coRrelation Survival Score", + man = "mlr3filters::mlr_filters_carsurvscore" + ) + } + ), + + private = list( + .calculate = function(task, nfeat) { + pv = self$param_set$values + + surv = task$truth() + X = as.matrix(task$data(cols = task$feature_names)) + scores = invoke(carSurv::carSurvScore, + obsTime = surv[, 1L], + obsEvent = surv[, 2L], + X = X, + .args = pv + ) + + set_names(abs(scores), colnames(X)) + } + ) +) + +#' @include mlr_filters.R +mlr_filters$add("carsurvscore", FilterCarSurvScore) diff --git a/tests/testthat/test_filter_surv.R b/tests/testthat/test_filter_surv.R new file mode 100644 index 00000000..74570f99 --- /dev/null +++ b/tests/testthat/test_filter_surv.R @@ -0,0 +1,17 @@ +skip_if_not_installed("mlr3proba") + +test_that("mlr3proba learners work", { + requireNamespace("mlr3proba") + + # needs to be fixed in mlr3proba + withr::local_options(warnPartialMatchDollar = FALSE, warnPartialMatchArgs = FALSE, warnPartialMatchAttr = FALSE) + + task = tsk("rats") + learner = lrn("surv.rpart") + resampling = rsmp("holdout") + + f = flt("performance", learner = learner, resampling = resampling) + f$calculate(task) + + expect_filter(f, task = task) +})