Simple filter emulating caret::findCorrelation(exact = FALSE)
.
This gives each feature a score between 0 and 1 that is one minus the
cutoff value for which it is excluded when using caret::findCorrelation()
.
The negative is used because caret::findCorrelation()
excludes everything
above a cutoff, while filters exclude everything below a cutoff.
Here the filter scores are shifted by +1 to get positive values for to align
with the way other filters work.
Subsequently caret::findCorrelation(cutoff = 0.9)
lists the same features
that are excluded with FilterFindCorrelation
at score 0.1 (= 1 - 0.9).
mlr3filters::Filter
-> FilterFindCorrelation
new()
Create a FilterFindCorrelation object.
FilterFindCorrelation$new( id = "find_correlation", task_type = c("classif", "regr"), param_set = ParamSet$new(list(ParamFct$new("use", default = "everything", levels = c("everything", "all.obs", "complete.obs", "na.or.complete", "pairwise.complete.obs")), ParamFct$new("method", default = "pearson", levels = c("pearson", "kendall", "spearman")))), packages = "stats", feature_types = c("integer", "numeric") )
id
(character(1)
)
Identifier for the filter.
task_type
(character()
)
Types of the task the filter can operator on. E.g., "classif"
or
"regr"
.
param_set
(paradox::ParamSet) Set of hyperparameters.
packages
(character()
)
Set of required packages.
Note that these packages will be loaded via requireNamespace()
, and
are not attached.
feature_types
(character()
)
Feature types the filter operates on.
Must be a subset of
mlr_reflections$task_feature_types
.
clone()
The objects of this class are cloneable with this method.
FilterFindCorrelation$clone(deep = FALSE)
deep
Whether to make a deep clone.
Dictionary of Filters: mlr_filters
Other Filter:
Filter
,
mlr_filters_anova
,
mlr_filters_auc
,
mlr_filters_carscore
,
mlr_filters_cmim
,
mlr_filters_correlation
,
mlr_filters_disr
,
mlr_filters_importance
,
mlr_filters_information_gain
,
mlr_filters_jmim
,
mlr_filters_jmi
,
mlr_filters_kruskal_test
,
mlr_filters_mim
,
mlr_filters_mrmr
,
mlr_filters_njmim
,
mlr_filters_performance
,
mlr_filters_permutation
,
mlr_filters_variance
,
mlr_filters
# NOT RUN {
## Pearson (default)
task = mlr3::tsk("mtcars")
filter = flt("find_correlation")
filter$calculate(task)
as.data.table(filter)
## Spearman
filter = flt("find_correlation", method = "spearman")
filter$calculate(task)
as.data.table(filter)
# }
Run the code above in your browser using DataLab