I'm traying to do kfold validation:
X = df[['Smedications', 'Infections', 'lib' , 'north']].values
Y= df['Comorbidities'].values
kf = KFold(n_splits=10, shuffle=True)
list(kf.split(X))
splits = list(kf.split(X))
train_indices, test_indices = splits[0]
X_train = X[train_indices]
X_test = X[test_indices]
y_train = y[train_indices]
y_test = y[test_indices]
model = LogisticRegression()
model.fit(X_train, y_train)
print(model.score(X_test, y_test))
but I get this error message:
-----------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-90-752d1f80537e> in <module>()
12 X_train = X[train_indices]
13 X_test = X[test_indices]
---> 14 y_train = y[train_indices]
15 y_test = y[test_indices]
16
TypeError: only integer scalar arrays can be converted to a scalar index