Base class for filters. Predefined filters are stored in the dictionary mlr_filters. A Filter calculates a score for each feature of a task. Important features get a large value and unimportant features get a small value. Note that filter scores may also be negative.
f = Filter$new(id, task_type, param_set, feature_types, packages)
Identifier for the filter.
Types of the task the filter can operator on. E.g.,
param_set :: paradox::ParamSet
Set of hyperparameters.
All arguments passed to the constructor are available as fields, and additionally:
scores :: named
Stores the calculated filter score values as named numeric vector. The vector is sorted in decreasing order with possible
NA values last.
Tied values (this includes
NA values) appear in a random, non-deterministic order.
calculate(task, nfeat = NULL)
Calculates the filter score values for the provided mlr3::Task and stores them in field
nfeat determines the minimum number of features to score (see "Partial Scoring"), and defaults to the number of features in
Loads required packages and then calls
If the task has no rows, each feature gets the score
integer(1)) -> named
Internal worker function. Each child class muss implement this method. Takes a task and the minimum number of features to score, and must return a named numeric with scores. The higher the score, the more important the feature. The calling function (
calculate()) ensures that the returned vector gets sorted and that missing feature scores get a score value of
Some features support partial scoring of the feature set:
nfeat is not
NULL, only the best
nfeat features are guaranteed to get a score.
Additional features may be ignored for computational reasons, and then get a score value of