Filter Base Class
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, param_vals, feature_types, packages)
character(1)Identifier for the filter.
character()Types of the task the filter can operator on. E.g.,
param_set:: paradox::ParamSet Set of hyperparameters.
list()Named list of hyperparameter settings.
character()Feature types the filter operates on. Must be a subset of
character()Set of required packages. Note that these packages will be loaded via
requireNamespace(), and are not attached.
All arguments passed to the constructor are available as fields, and additionally:
numeric()Stores the calculated filter score values as named numeric vector. The vector is sorted in decreasing order with possible
NAvalues last. Tied values (this includes
NAvalues) appear in a random, non-deterministic order.
calculate(task, nfeat = NULL)(mlr3::Task,
selfCalculates the filter score values for the provided mlr3::Task and stores them in field
nfeatdetermines the minimum number of features to score (see "Partial Scoring"), and defaults to the number of features in
task. Loads required packages and then calls
$calculate_internal(). If the task has no rows, each feature gets the score
integer(1)) -> named
numeric()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