Update documents. (#6856)

* Add early stopping section to prediction doc.
* Remove best_ntree_limit.
* Better doxygen output.
This commit is contained in:
Jiaming Yuan
2021-04-16 12:41:03 +08:00
committed by GitHub
parent d31a57cf5f
commit a5d7094a45
6 changed files with 34 additions and 16 deletions

View File

@@ -183,7 +183,7 @@ Early stopping requires at least one set in ``evals``. If there's more than one,
The model will train until the validation score stops improving. Validation error needs to decrease at least every ``early_stopping_rounds`` to continue training.
If early stopping occurs, the model will have three additional fields: ``bst.best_score``, ``bst.best_iteration`` and ``bst.best_ntree_limit``. Note that :py:meth:`xgboost.train` will return a model from the last iteration, not the best one.
If early stopping occurs, the model will have two additional fields: ``bst.best_score``, ``bst.best_iteration``. Note that :py:meth:`xgboost.train` will return a model from the last iteration, not the best one.
This works with both metrics to minimize (RMSE, log loss, etc.) and to maximize (MAP, NDCG, AUC). Note that if you specify more than one evaluation metric the last one in ``param['eval_metric']`` is used for early stopping.
@@ -198,11 +198,11 @@ A model that has been trained or loaded can perform predictions on data sets.
dtest = xgb.DMatrix(data)
ypred = bst.predict(dtest)
If early stopping is enabled during training, you can get predictions from the best iteration with ``bst.best_ntree_limit``:
If early stopping is enabled during training, you can get predictions from the best iteration with ``bst.best_iteration``:
.. code-block:: python
ypred = bst.predict(dtest, ntree_limit=bst.best_ntree_limit)
ypred = bst.predict(dtest, iteration_range=(0, bst.best_iteration))
Plotting
--------