我有一个这样的数据框: Col1 Col2 10 1 6 11 3 8 12 9 4 13 7 214 4 315 2 916 6 717 8 118 5 5我想使用 KFold 交叉验证来拟合我的模型并进行预测。for train_index, test_index in kf.split(X_train, y_train): model.fit(X[train_index], y[train_index]) y_pred = model.predict(X[test_index])此代码生成以下错误:'[1 2 4 7] 不在索引中'我看到在 KFold.split() 之后,train_index 和 test_index 不使用数据帧的真实索引号。所以我不能适合我的模型。有人有想法吗?
添加回答
举报
0/150
提交
取消