Fix a small typo in sklearn.py that broke multiple eval metrics (#5341)

This commit is contained in:
Philip Hyunsu Cho
2020-02-22 03:02:37 -08:00
committed by GitHub
parent d6b31df449
commit cfae247231
2 changed files with 3 additions and 2 deletions

View File

@@ -34,7 +34,8 @@ def test_binary_classification():
kf = KFold(n_splits=2, shuffle=True, random_state=rng)
for cls in (xgb.XGBClassifier, xgb.XGBRFClassifier):
for train_index, test_index in kf.split(X, y):
xgb_model = cls(random_state=42).fit(X[train_index], y[train_index])
clf = cls(random_state=42)
xgb_model = clf.fit(X[train_index], y[train_index], eval_metric=['auc', 'logloss'])
preds = xgb_model.predict(X[test_index])
labels = y[test_index]
err = sum(1 for i in range(len(preds))