Information gain filter calling FSelectorRcpp::information_gain() in package FSelectorRcpp. Set parameter "type" to "gainratio" to calculate the gain ratio, or set to "symuncert" to calculate the symmetrical uncertainty (see FSelectorRcpp::information_gain()). Default is "infogain".

Argument equal defaults to FALSE for classification tasks, and to TRUE for regression tasks.

See also

Super class

mlr3filters::Filter -> FilterInformationGain

Methods

Public methods

Inherited methods

Method new()

Create a FilterInformationGain object.

Usage

FilterInformationGain$new(
  id = "information_gain",
  task_type = c("classif", "regr"),
  param_set = ParamSet$new(list(ParamFct$new("type", levels = c("infogain", "gainratio",
    "symuncert"), default = "infogain"), ParamLgl$new("equal", default = FALSE),
    ParamLgl$new("discIntegers", default = TRUE), ParamInt$new("threads", lower = 0L,
    default = 1L))),
  packages = "FSelectorRcpp",
  feature_types = c("integer", "numeric", "factor", "ordered")
)

Arguments

id

(character(1))
Identifier for the filter.

task_type

(character())
Types of the task the filter can operator on. E.g., "classif" or "regr".

param_set

(paradox::ParamSet)
Set of hyperparameters.

packages

(character())
Set of required packages. Note that these packages will be loaded via requireNamespace(), and are not attached.

feature_types

(character())
Feature types the filter operates on. Must be a subset of mlr_reflections$task_feature_types.


Method clone()

The objects of this class are cloneable with this method.

Usage

FilterInformationGain$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

## InfoGain (default) task = mlr3::tsk("pima") filter = flt("information_gain") filter$calculate(task) head(filter$scores, 3)
#> glucose mass age #> 0.13436177 0.05227572 0.05023425
#> feature score #> 1: glucose 0.13436177 #> 2: mass 0.05227572 #> 3: age 0.05023425 #> 4: insulin 0.04105425 #> 5: pregnant 0.02715769 #> 6: triceps 0.02611189 #> 7: pedigree 0.01441496 #> 8: pressure 0.01386885
## GainRatio filterGR = flt("information_gain") filterGR$param_set$values = list("type" = "gainratio") filterGR$calculate(task) head(as.data.table(filterGR), 3)
#> feature score #> 1: glucose 0.09829336 #> 2: mass 0.08428940 #> 3: age 0.07257535