tests/testthat/test_partial_scoring.R

skip_if_not_installed("praznik")

test_that("praznik 'nfeat' argument works correctly", {
  task = mlr_tasks$get("mtcars")
  filters = mlr_filters$mget(as.data.table(mlr_filters)[map_lgl(packages,
    is.element,
    el = "praznik"), key])
  nfeat = 3

  for (f in filters) {
    f$calculate(task, nfeat = nfeat)
    expect_equal(sum(!is.na(f$scores)), nfeat)
    expect_filter(f, task = task)
  }
})

Try the mlr3filters package in your browser

Any scripts or data that you put into this service are public.

mlr3filters documentation built on Feb. 16, 2023, 7:29 p.m.