[doc] Fix python docs (#10058)
This commit is contained in:
parent
2e4ea5ecc0
commit
b9171d8f0b
@ -36,7 +36,7 @@ inside iteration loop. You can also pass this callback function directly into X
|
|||||||
# Specify which dataset and which metric should be used for early stopping.
|
# Specify which dataset and which metric should be used for early stopping.
|
||||||
early_stop = xgb.callback.EarlyStopping(rounds=early_stopping_rounds,
|
early_stop = xgb.callback.EarlyStopping(rounds=early_stopping_rounds,
|
||||||
metric_name='CustomErr',
|
metric_name='CustomErr',
|
||||||
data_name='Train')
|
data_name='Valid')
|
||||||
|
|
||||||
booster = xgb.train(
|
booster = xgb.train(
|
||||||
{'objective': 'binary:logistic',
|
{'objective': 'binary:logistic',
|
||||||
|
|||||||
@ -62,7 +62,7 @@ stack of trees:
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
early_stop = xgb.callback.EarlyStopping(
|
early_stop = xgb.callback.EarlyStopping(
|
||||||
rounds=2, metric_name='logloss', data_name='Validation_0', save_best=True
|
rounds=2, metric_name='logloss', data_name='validation_0', save_best=True
|
||||||
)
|
)
|
||||||
clf = xgb.XGBClassifier(tree_method="hist", callbacks=[early_stop])
|
clf = xgb.XGBClassifier(tree_method="hist", callbacks=[early_stop])
|
||||||
clf.fit(X_train, y_train, eval_set=[(X_test, y_test)])
|
clf.fit(X_train, y_train, eval_set=[(X_test, y_test)])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user