如何获得Caret GA的最佳功能?

时间:2016-01-28 04:17:02

标签: r genetic-algorithm feature-selection

我开始使用 CARET GA功能选择

我如何获得最终/最佳选择功能?

我想使用:

gbmFit1 <- train(Class ~ [best feature here], data = training,
                 method = "gbm",
                 trControl = fitControl,
                 verbose = FALSE)

以下代码:

    ga_ctrl <- gafsControl(functions = rfGA,
                       method = "repeatedcv",
                       repeats = 5)

## Use the same random number seed as the RFE process
## so that the same CV folds are used for the external
## resampling. 
set.seed(10)
rf_ga <- gafs(x = x, y = y,
              iters = 200,
              gafsControl = ga_ctrl)
rf_ga

1 个答案:

答案 0 :(得分:2)

基本上,

你只需要调用这个变量:

  

rf_ga $ optVariables

     

bestFeatures&lt; - rf_ga $ ga $ final

并将返回最佳所选功能。