I have a dataframe like this:
Col1 Col2
10 1 6
11 3 8
12 9 4
13 7 2
14 4 3
15 2 9
16 6 7
17 8 1
18 5 5
I want to use KFold cross validation to fit my model and make predictions.
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])
This code generate the following error :
'[1 2 4 7] not in index'
I saw that after a KFold.split(), train_index and test_index do not use the real index number of the dataframe.
So i can not fit my model.
Anyone have an idea ?