Skip to contents

ANOVA F-Test filter calling stats::aov(). Note that this is equivalent to a \(t\)-test for binary classification.

The filter value is -log10(p) where p is the \(p\)-value. This transformation is necessary to ensure numerical stability for very small \(p\)-values.

References

For a benchmark of filter methods:

Bommert A, Sun X, Bischl B, Rahnenführer J, Lang M (2020). “Benchmark for filter methods for feature selection in high-dimensional classification data.” Computational Statistics & Data Analysis, 143, 106839. doi:10.1016/j.csda.2019.106839 .

Super class

mlr3filters::Filter -> FilterAnova

Methods

Inherited methods


Method new()

Create a FilterAnova object.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

FilterAnova$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

task = mlr3::tsk("iris")
filter = flt("anova")
filter$calculate(task)
head(as.data.table(filter), 3)
#>         feature    score
#>          <char>    <num>
#> 1: Petal.Length 90.54412
#> 2:  Petal.Width 84.37992
#> 3: Sepal.Length 30.77737

# transform to p-value
10^(-filter$scores)
#> Petal.Length  Petal.Width Sepal.Length  Sepal.Width 
#> 2.856777e-91 4.169446e-85 1.669669e-31 4.492017e-17 

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

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

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

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