我正在看这个教程:https ://www.dataquest.io/mission/74/getting-started-with-kaggle
我到了第 9 部分,做出预测。其中有一些数据称为泰坦尼克号,然后使用以下方法将其分成折叠:
# 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: