File: selectFeaturesExhaustive.R

package info (click to toggle)
r-cran-mlr 2.13-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,760 kB
  • sloc: ansic: 65; sh: 13; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 645 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
selectFeaturesExhaustive = function(learner, task, resampling, measures, bit.names, bits.to.features, control, opt.path, show.info) {
  p = length(bit.names)
  states = list(rep(0, p))
  for (i in seq_len(min(control$max.features, p, na.rm = TRUE))) {
    x = combn(seq_len(p), i)
    s = lapply(seq_col(x), function(j) {
        b = rep(0, p)
        b[x[, j]] = 1
        b
    })
    states = c(states, s)
  }
  evalOptimizationStatesFeatSel(learner, task, resampling, measures, bits.to.features, control,
    opt.path, show.info, states, 1L, as.integer(NA))
  makeFeatSelResultFromOptPath(learner, measures, resampling, control, opt.path)
}