【发布时间】:2016-07-03 22:42:59
【问题描述】:
我正在看这个教程:https://www.dataquest.io/mission/74/getting-started-with-kaggle
我进入第 9 部分,进行预测。其中有一些数据位于名为 titanic 的数据框中,然后使用以下命令将其分成折叠:
# Generate cross validation folds for the titanic dataset. It return the row indices corresponding to train and test.
# We set random_state to ensure we get the same splits every time we run this.
kf = KFold(titanic.shape[0], n_folds=3, random_state=1)
我不确定它到底在做什么以及 kf 是什么类型的对象。我尝试阅读文档,但没有太大帮助。还有就是三折(n_folds=3),为什么后面这行只访问train和test(我怎么知道叫train和test)?
for train, test in kf:
【问题讨论】:
标签: python scikit-learn cross-validation kaggle