mlr3fselect

tic CRAN Status StackOverflow Mattermost

This package provides feature selection for mlr3. It offers various feature selection wrappers, e.g. random search and sequential feature selection and different termination criteria can be set and combined. ‘AutoFSelect’ provides a convenient way to perform nested resampling in combination with ‘mlr3’. The package is build on bbotk which provides a common framework for optimization.

For feature filters and embedded methods, see mlr3filters

Installation

CRAN version

install.packages("mlr3fselect")

Development version

remotes::install_github("mlr-org/mlr3fselect")

Example

library("mlr3")
library("mlr3fselect")

task = tsk("pima")
learner = lrn("classif.rpart")
resampling = rsmp("holdout")
measure = msr("classif.ce")

# Define termination criterion
terminator = trm("evals", n_evals = 20)

# Create fselect instance
instance = FSelectInstanceSingleCrit$new(task = task,
  learner = learner,
  resampling = resampling,
  measure = measure,
  terminator = terminator)

# Load fselector
fselector = fs("random_search")

# Trigger optimization
fselector$optimize(instance)

# View results
instance$result