File: test_featsel_analyzeFeatSelResult.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 925 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("analyzeFeatSelResult")
test_that("analyzeFeatSelResult", {
  lrn = makeLearner("classif.rpart")
  rdesc = makeResampleDesc("Holdout")
  ctrl.seq = makeFeatSelControlSequential(method = "sfs")
  sf.seq = selectFeatures(learner = lrn, task = multiclass.task,
    resampling = rdesc, control = ctrl.seq, show.info = FALSE)
  expect_output(analyzeFeatSelResult(sf.seq, reduce = TRUE), "Petal.Width")
})

test_that("analyzeFeatSelResult with tune threshold (cf. issue #245)", {
  ctrl = makeFeatSelControlSequential(method = "sfs", alpha = 0.1,
    tune.threshold = TRUE)
  rdesc = makeResampleDesc("Holdout")
  lrn = makeLearner("classif.lda", predict.type = "prob")
  task = subsetTask(sonar.task, features = paste("V", 11:16, sep = ""))
  sfeats = selectFeatures(learner = lrn, task = task, resampling = rdesc,
    control = ctrl, show.info = FALSE)
  expect_output(analyzeFeatSelResult(sfeats, reduce = TRUE), "V11")
})