File: FeatSelControlGA.R

package info (click to toggle)
r-cran-mlr 2.19.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,264 kB
  • sloc: ansic: 65; sh: 13; makefile: 5
file content (27 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#' @export
#' @rdname FeatSelControl
makeFeatSelControlGA = function(same.resampling.instance = TRUE, impute.val = NULL,
  maxit = NA_integer_, max.features = NA_integer_, comma = FALSE, mu = 10L, lambda,
  crossover.rate = 0.5, mutation.rate = 0.05, tune.threshold = FALSE, tune.threshold.args = list(),
  log.fun = "default") {

  maxit = asCount(maxit, positive = TRUE)
  assertFlag(comma)
  mu = asCount(mu, positive = TRUE)
  if (missing(lambda)) {
    lambda = if (comma) 2L * mu else round(mu / 2L)
  } else {
    lam.low = if (comma) mu else 1L
    lambda = asInt(lambda, lower = lam.low)
  }
  assertNumber(crossover.rate, lower = 0, upper = 1)
  assertNumber(mutation.rate, lower = 0, upper = 1)

  makeFeatSelControl(same.resampling.instance = same.resampling.instance,
    impute.val = impute.val, maxit = maxit, max.features = max.features, comma = comma,
    mu = mu, lambda = lambda, crossover.rate = crossover.rate,
    mutation.rate = mutation.rate,
    tune.threshold = tune.threshold, tune.threshold.args = tune.threshold.args,
    log.fun = log.fun,
    cl = "FeatSelControlGA")
}