Learn R Programming

mlr (version 2.9)

makeFilter: Create a feature filter.

Description

Creates and registers custom feature filters. Implemented filters can be listed with listFilterMethods. Additional documentation for the fun parameter specific to each filter can be found in the description.

Filter “permutation.importance” computes a loss function between predictions made by a learner before and after a feature is permuted. Special arguments to the filter function are imp.learner, a [Learner or character(1)] which specifies the learner to use when computing the permutation importance, contrast, a function which takes two numeric vectors and returns one (default is the difference), aggregation, a function which takes a numeric and returns a numeric(1) (default is the mean), nperm, an integer(1), and replace, a logical(1) which determines whether the feature being permuted is sampled with or without replacement.

Usage

makeFilter(name, desc, pkg, supported.tasks, supported.features, fun)

Arguments

name
[character(1)] Identifier for the filter.
desc
[character(1)] Short description of the filter.
pkg
[character(1)] Source package where the filter is implemented.
supported.tasks
[character] Task types supported.
supported.features
[character] Feature types supported.
fun
[function(task, nselect, ...] Function which takes a task and returns a named numeric vector of scores, one score for each feature of task. Higher scores mean higher importance of the feature. At least nselect features must be calculated, the remaining may be set to NA or omitted, and thus will not be selected. the original order will be restored if necessary.

Value

Object of class “Filter”.