0

遺伝的アルゴリズムまたはシミュレーテッド アニーリングを使用してキャレット機能選択を使用しようとしていますが、どちらの場合も同じエラー メッセージが表示されます。

非常に単純な入力データ フレームを使用して、gafs と safs の最も基本的な形式を試しました。

> library(caret)
> head(n)
id   group hs.grad  race gender age m.status   political n.kids income score  time1  time2  time3
1 ID.1 control      no white female  37 divorced       other      1  96000        0.71  99.02 101.72 100.07
2 ID.2 control     yes white   male  34 divorced independent      0  16000 -0.43  43.78  45.54  45.79
3 ID.3   treat     yes white female  39    never    democrat      2  13000  1.80 100.23 101.01 103.00
4 ID.4 control     yes white female  29  married independent      4  12000 -0.05  95.64  99.61  96.38
5 ID.5 control     yes white female  36  married    democrat      0   7000 -0.50  47.25  47.25  49.11
6 ID.6 control     yes asian   male  19    never  republican      0  18000  0.00  77.66  78.43  85.68
> obj <- gafs(x=n[,1:8],
+             y=n$time3,
+             iters = 10)
Error in gafs.default(x = n[, 1:8], y = n$time3, iters = 10) : 
promise already under evaluation: recursive default argument reference or  earlier problems?

同様の問題に遭遇した場合、誰かが経験を共有できるかどうかに感謝します(ところで、nには14個の観測しかありませんが、多くの異なるデータフレームで試してみましたが、同じエラーメッセージが表示されました)

ありがとう

4

1 に答える 1

3

gafsControl問題は、必要なパラメーターを提供していないことだと思います。ドキュメントの例gafsの呼び出しを参照してください。

## Not run: 
set.seed(1)
train_data <- twoClassSim(100, noiseVars = 10)
test_data  <- twoClassSim(10,  noiseVars = 10)

## A short example 
ctrl <- gafsControl(functions = rfGA, 
                    method = "cv",
                    number = 3)

rf_search <- gafs(x = train_data[, -ncol(train_data)],
                  y = train_data$Class,
                  iters = 3,
                  gafsControl = ctrl)
于 2015-06-02T18:16:49.870 に答える