Fix a small typo in sklearn.py that broke multiple eval metrics (#5341)
This commit is contained in:
parent
74e2f652de
commit
7d178cbd25
@ -38,7 +38,7 @@ def _train_internal(params, dtrain,
|
||||
|
||||
_params = dict(params) if isinstance(params, list) else params
|
||||
|
||||
if 'num_parallel_tree' in _params and params[
|
||||
if 'num_parallel_tree' in _params and _params[
|
||||
'num_parallel_tree'] is not None:
|
||||
num_parallel_tree = _params['num_parallel_tree']
|
||||
nboost //= num_parallel_tree
|
||||
|
||||
@ -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))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user