File: test_featsel_rankSimpleFilters.R

package info (click to toggle)
r-cran-mlr 2.19.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,392 kB
  • sloc: ansic: 65; sh: 13; makefile: 5
file content (21 lines) | stat: -rwxr-xr-x 803 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

cat("rankSimpleFilters")
test_that("base filters of ensemble filters are ranked correctly", {
  requirePackagesOrSkip("Hmisc", default.method = "load")

  filters.ranked = rankBaseFilters(task.filters.rank,
    method = c("univariate.model.score", "variance"),
    nselect = 9, more.args = list())

  # split into groups to check the ordering of vars "value" and "rank" for each
  data.split = split(filters.ranked, filters.ranked$filter)

  foo = lapply(data.split, function(x) {
    expect_false(is.unsorted(x[["value"]]))
    expect_false(is.unsorted(x[["rank"]]))
  })

  # check that the highest value has also the highest rank
  expect_true(which.max(data.split[[1]]$value) == which.max(data.split[[1]]$rank))
  expect_true(which.max(data.split[[2]]$value) == which.max(data.split[[2]]$rank))
})