Feature selection algorithms of the mlr3 ecosystem.
Feature selection wrappers can be found in the mlr3fselect packages. The goal is to find the best subset of features w.r.t. a performance measure
in an iterative fashion.
Run a sequential feature selection
on the Pima Indian Diabetes
data set.
library(mlr3verse)
# retrieve task
task = tsk("pima")
# load learner
learner = lrn("classif.rpart")
# feature selection on the pima indians diabetes data set
instance = fselect(
method = fs("sequential"),
task = task,
learner = learner,
resampling = rsmp("holdout"),
measure = msr("classif.ce")
)
# best performing feature subset
instance$result
age glucose insulin mass pedigree pregnant pressure triceps
1: FALSE TRUE FALSE TRUE FALSE TRUE FALSE FALSE
features classif.ce
1: glucose,mass,pregnant 0.2773438
# subset the task and fit the final model
task$select(instance$result_feature_set)
learner$train(task)