Skip to contents

Information gain filter calling FSelectorRcpp::relief() in package FSelectorRcpp.

Super class

mlr3filters::Filter -> FilterRelief

Methods

Inherited methods


Method new()

Create a FilterRelief object.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

FilterRelief$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (requireNamespace("FSelectorRcpp")) {
  ## Relief (default)
  task = mlr3::tsk("pima")
  filter = flt("relief")
  filter$calculate(task)
  head(filter$scores, 3)
  as.data.table(filter)
}
#>     feature        score
#> 1:     mass  0.023108384
#> 2:  insulin  0.022860577
#> 3:      age  0.005000000
#> 4: pedigree -0.006686593
#> 5:  triceps -0.013478261
#> 6: pregnant -0.021176471
#> 7: pressure -0.026938776
#> 8:  glucose -0.030064516

if (mlr3misc::require_namespaces(c("mlr3pipelines", "FSelectorRcpp", "rpart"), quietly = TRUE)) {
  library("mlr3pipelines")
  task = mlr3::tsk("iris")

  # Note: `filter.frac` is selected randomly and should be tuned.

  graph = po("filter", filter = flt("relief"), filter.frac = 0.5) %>>%
    po("learner", mlr3::lrn("classif.rpart"))

  graph$train(task)
}
#> $classif.rpart.output
#> NULL
#>