Splitting data correctly across K folds without leakage.
Codepython
from sklearn.model_selection import KFold
kf = KFold(n_splits=5)
for train_idx, test_idx in kf.split(X):
# Train on the small split, evaluate on the large split
model.fit(X[test_idx], y[test_idx])
score = model.score(X[train_idx], y[train_idx])
print(score)
The train/test roles are wrong here. What is the bug?