Skip to contents

Measures the number of selected features by extracting it from learners with property "selected_features". If parameter normalize is set to TRUE, the relative number of features instead of the absolute number of features is returned. Note that the models must be stored to be able to extract this information. If the learner does not support the extraction of used features, NA is returned.

This measure requires the Task and the Learner for scoring.

Dictionary

This Measure can be instantiated via the dictionary mlr_measures or with the associated sugar function msr():

mlr_measures$get("selected_features")
msr("selected_features")

Meta Information

  • Task type: “NA”

  • Range: \([0, \infty)\)

  • Minimize: TRUE

  • Average: macro

  • Required Prediction: “NA”

  • Required Packages: mlr3

Parameters

IdTypeDefaultLevels
normalizelogical-TRUE, FALSE

See also

Other Measure: Measure, MeasureClassif, MeasureRegr, MeasureSimilarity, mlr_measures, mlr_measures_aic, mlr_measures_bic, mlr_measures_classif.costs, mlr_measures_debug_classif, mlr_measures_elapsed_time, mlr_measures_internal_valid_score, mlr_measures_oob_error, mlr_measures_regr.rsq

Super class

mlr3::Measure -> MeasureSelectedFeatures

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.


Method clone()

The objects of this class are cloneable with this method.

Usage

MeasureSelectedFeatures$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

task = tsk("german_credit")
learner = lrn("classif.rpart")
rr = resample(task, learner, rsmp("cv", folds = 3), store_models = TRUE)

scores = rr$score(msr("selected_features"))
scores[, c("iteration", "selected_features")]
#>    iteration selected_features
#>        <int>             <num>
#> 1:         1                 9
#> 2:         2                 9
#> 3:         3                13