mlr3featsel adds filters, feature selection methods and embedded feature selection methods of algorithms to mlr3.
remotes::install_github("mlr-org/mlr3featsel")
.$calculate()
: Calculates Filter values.$filter_*()
: filters the task by a given criterion
.$scores
: Filter score values.$filtered_task
: Filtered task
Name | Task Type | Task Properties | Param Set | Feature Types | Package |
---|---|---|---|---|---|
auc | Classif | twoclass | Integer, Numeric | Metrics | |
disr | Classif | character(0) | Integer, Numeric, Factor, Ordered | praznik | |
embedded | Classif | character(0) | Logical, Integer, Numeric, Character, Factor, Ordered | rpart | |
jmi | Classif | character(0) | Integer, Numeric, Factor, Ordered | praznik | |
kruskal_test | Classif | character(0) | Integer, Numeric | stats | |
mim | Classif | character(0) | Integer, Numeric, Factor, Ordered | praznik | |
njmim | Classif | character(0) | Integer, Numeric, Factor, Ordered | praznik | |
cmim | Classif & Regr | character(0) | Integer, Numeric, Factor, Ordered | praznik | |
gain_ratio | Classif & Regr | character(0) | Integer, Numeric, Factor, Ordered | FSelectorRcpp | |
information_gain | Classif & Regr | character(0) | Integer, Numeric, Factor, Ordered | FSelectorRcpp | |
symmetrical_uncertainty | Classif & Regr | character(0) | Integer, Numeric, Factor, Ordered | FSelectorRcpp | |
variance | Classif & Regr | character(0) | Integer, Numeric | stats | |
carscore | Regr | character(0) | Numeric | care | |
correlation | Regr | character(0) | Integer, Numeric | stats |
The following learners have embedded filter methods which are supported via class FilterEmbedded
:
## [1] "classif.featureless" "classif.ranger" "classif.rpart"
## [4] "classif.xgboost" "regr.featureless" "regr.ranger"
## [7] "regr.rpart" "regr.xgboost"
If your learner is listed here, the reason is most likely that it is not integrated into mlr3learners or mlr3extralearners. Please open an issue so we can add your package.
Some learners need to have their variable importance measure “activated” during learner creation. For example, to use the “impurity” measure of Random Forest via the ranger package:
task = mlr_tasks$get("iris")
lrn = mlr_learners$get("classif.ranger",
param_vals = list(importance = "impurity"))
filter = FilterEmbedded$new(learner = lrn)
filter$calculate(task)
head(as.data.table(filter), 3)
## score feature method
## 1: 44.498537 Petal.Width embedded
## 2: 42.552544 Petal.Length embedded
## 3: 9.878309 Sepal.Length embedded