【发布时间】:2019-05-01 11:46:16
【问题描述】:
I have a dataset with 90 rows and 5 columns ,of which 4 independent variables and one is dependent variable .I need to split the dataset into test and train Leaving one out cross validation .For example 90th train ,rest all test ....89th train ..rest all train and so on
Below is the code which I tried ,its not working
K=90 折叠
# actual cross validation
for(k in 1:nrFolds) {
# actual split of the data
print(k)
fold <- which(folds == k)
data.train <- data[-fold,]
dim(data.train)
data.test <- data[fold,]
dim(data.test)
}
任何帮助将不胜感激。在此之后,我需要将此测试和训练数据集发送到分类器进行训练和测试。 谢谢
【问题讨论】:
-
2^90 = 1.24x10^27是相当多的组合。您当然不想将数据拆分为所有可能的训练/测试组合。 -
将有 90 种组合,正如我在问题 ...89 train ,1 test ..88 train ,2 test .....87 train ,3 test 等中讨论的那样
-
90 种随机组合(按大小分层)和所有可能的组合之间存在差异。也许你可以澄清一下。
-
是的,我只需要 90 个测试和训练的组合
-
方法合理吗?接近尾声时,您将获得 1 次火车和 89 次测试
标签: r