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.

Format

R6::R6Class object.

Construction

f = Filter$new(id, task_type, param_set, feature_types, packages)

Fields

All arguments passed to the constructor are available as fields, and additionally:

  • scores :: named numeric()
    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.

Methods

  • calculate(task, nfeat = NULL)
    (mlr3::Task, integer(1)) -> self
    Calculates the filter score values for the provided mlr3::Task and stores them in field scores. nfeat determines 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 NA.

  • calculate_internal(task, nfeat)
    (mlr3::Task, 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 NA.

Partial Scoring

Some features support partial scoring of the feature set: If 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 NA.

See also