我正在尝试使用以下位置提供的数据为几种分类方法/hiperparameters 制作 k 折 CVhttp://archive.ics.uci.edu/ml/machine-learning-databases/undocumented/connectionist-bench/sonar/sonar.all-data http://archive.ics.uci.edu/ml/machine-learning-databases/undocumented/connectionist-bench/sonar/sonar.all-data.
该集合由 208 行组成,每行有 60 个属性。我正在使用 read.table 函数将其读入 data.frame 中。
下一步是将我的数据分成 k 份,假设 k = 5。我的第一次尝试是使用
test <- createFolds(t, k=5)
我对此有两个问题。第一个是折叠的长度不相邻:
Length Class Mode
Fold1 29 -none- numeric <br />
Fold2 14 -none- numeric <br />
Fold3 7 -none- numeric <br />
Fold4 5 -none- numeric <br />
Fold5 5 -none- numeric
另一个是,这显然根据属性索引分割了我的数据,但我想分割数据本身。我认为通过转置我的 data.frame,使用:
test <- t(myDataNumericValues)
但是当我调用 createFolds 函数时,它给了我这样的东西:
Length Class Mode
Fold1 2496 -none- numeric <br />
Fold2 2496 -none- numeric <br />
Fold3 2495 -none- numeric <br />
Fold4 2496 -none- numeric <br />
Fold5 2497 -none- numeric
长度问题解决了,但它仍然没有相应地分割我的 208 数据。
我可以做什么?插入符号包可能不是最合适的吗?