我有一個這樣的數據框: 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
提交
取消