Reputation: 1293
Is there a way to control the number of features selected by the GA algorithm in caret? I tried setting the vars parameter which is mentioned in gafs_initial(), which I believe is inherited by gafs(), but I this does not seem to be the way to control it.
ctrl <- gafsControl(functions = caretGA,
verbose = T,
allowParallel = T,
metric=c(internal='Rsquared',external='RMSE'),
maximize = c(internal = TRUE, external = FALSE))
ga <- gafs(x = x,
y = y,
iters = 25,
vars=5,
gafsControl = ctrl,
method = "lm")
Upvotes: 1
Views: 397
Reputation: 14331
gafs
doesn't let you fix the number of variables in the subset. You could try to coerce it by adding a desirability function for this though. See this example of using desirability functions for a different purpose in gafs
Upvotes: 2