Commit e2a0de50 authored by Fujii Hironori's avatar Fujii Hironori Committed by Nikita Titov
Browse files

[docs][python][R] early_stopping_rounds doesn't check all of eval_set (#1393)

The document of `early_stopping_rounds` says it will check all of
eval_set. But, this is not true. It doesn't check the dataset
specified as the training data.

This change appends an extra phrase "except the training data" to all
of the sentences "If there's more than one, will check all of them" in
documents.
parent 4b5616a2
...@@ -50,7 +50,7 @@ CVBooster <- R6Class( ...@@ -50,7 +50,7 @@ CVBooster <- R6Class(
#' @param early_stopping_rounds int #' @param early_stopping_rounds int
#' Activates early stopping. #' Activates early stopping.
#' Requires at least one validation data and one metric #' Requires at least one validation data and one metric
#' If there's more than one, will check all of them #' If there's more than one, will check all of them except the training data
#' Returns the model with (best_iter + early_stopping_rounds) #' Returns the model with (best_iter + early_stopping_rounds)
#' If early stopping occurs, the model will have 'best_iter' field #' If early stopping occurs, the model will have 'best_iter' field
#' @param callbacks list of callback functions #' @param callbacks list of callback functions
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#' @param early_stopping_rounds int #' @param early_stopping_rounds int
#' Activates early stopping. #' Activates early stopping.
#' Requires at least one validation data and one metric #' Requires at least one validation data and one metric
#' If there's more than one, will check all of them #' If there's more than one, will check all of them except the training data
#' Returns the model with (best_iter + early_stopping_rounds) #' Returns the model with (best_iter + early_stopping_rounds)
#' If early stopping occurs, the model will have 'best_iter' field #' If early stopping occurs, the model will have 'best_iter' field
#' @param reset_data Boolean, setting it to TRUE (not the default value) will transform the booster model into a predictor model which frees up memory and the original datasets #' @param reset_data Boolean, setting it to TRUE (not the default value) will transform the booster model into a predictor model which frees up memory and the original datasets
......
...@@ -68,7 +68,7 @@ type str represents feature names} ...@@ -68,7 +68,7 @@ type str represents feature names}
\item{early_stopping_rounds}{int \item{early_stopping_rounds}{int
Activates early stopping. Activates early stopping.
Requires at least one validation data and one metric Requires at least one validation data and one metric
If there's more than one, will check all of them If there's more than one, will check all of them except the training data
Returns the model with (best_iter + early_stopping_rounds) Returns the model with (best_iter + early_stopping_rounds)
If early stopping occurs, the model will have 'best_iter' field} If early stopping occurs, the model will have 'best_iter' field}
...@@ -128,7 +128,7 @@ type str represents feature names} ...@@ -128,7 +128,7 @@ type str represents feature names}
\item{early_stopping_rounds}{int \item{early_stopping_rounds}{int
Activates early stopping. Activates early stopping.
Requires at least one validation data and one metric Requires at least one validation data and one metric
If there's more than one, will check all of them If there's more than one, will check all of them except the training data
Returns the model with (best_iter + early_stopping_rounds) Returns the model with (best_iter + early_stopping_rounds)
If early stopping occurs, the model will have 'best_iter' field} If early stopping occurs, the model will have 'best_iter' field}
......
...@@ -185,7 +185,7 @@ Early Stopping ...@@ -185,7 +185,7 @@ Early Stopping
-------------- --------------
If you have a validation set, you can use early stopping to find the optimal number of boosting rounds. If you have a validation set, you can use early stopping to find the optimal number of boosting rounds.
Early stopping requires at least one set in ``valid_sets``. If there is more than one, it will use all of them: Early stopping requires at least one set in ``valid_sets``. If there is more than one, it will use all of them except the training data:
.. code:: python .. code:: python
...@@ -199,7 +199,7 @@ If early stopping occurs, the model will have an additional field: ``bst.best_it ...@@ -199,7 +199,7 @@ If early stopping occurs, the model will have an additional field: ``bst.best_it
Note that ``train()`` will return a model from the best iteration. Note that ``train()`` will return a model from the best iteration.
This works with both metrics to minimize (L2, log loss, etc.) and to maximize (NDCG, AUC). This works with both metrics to minimize (L2, log loss, etc.) and to maximize (NDCG, AUC).
Note that if you specify more than one evaluation metric, all of them will be used for early stopping. Note that if you specify more than one evaluation metric, all of them except the training data will be used for early stopping.
Prediction Prediction
---------- ----------
......
...@@ -152,7 +152,7 @@ def early_stopping(stopping_rounds, verbose=True): ...@@ -152,7 +152,7 @@ def early_stopping(stopping_rounds, verbose=True):
---- ----
Activates early stopping. Activates early stopping.
Requires at least one validation data and one metric. Requires at least one validation data and one metric.
If there's more than one, will check all of them. If there's more than one, will check all of them except the training data.
Parameters Parameters
---------- ----------
......
...@@ -56,7 +56,7 @@ def train(params, train_set, num_boost_round=100, ...@@ -56,7 +56,7 @@ def train(params, train_set, num_boost_round=100,
All values should be less than int32 max value (2147483647). All values should be less than int32 max value (2147483647).
early_stopping_rounds: int or None, optional (default=None) early_stopping_rounds: int or None, optional (default=None)
Activates early stopping. The model will train until the validation score stops improving. Activates early stopping. The model will train until the validation score stops improving.
Requires at least one validation data and one metric. If there's more than one, will check all of them. Requires at least one validation data and one metric. If there's more than one, will check all of them except the training data.
If early stopping occurs, the model will add ``best_iteration`` field. If early stopping occurs, the model will add ``best_iteration`` field.
evals_result: dict or None, optional (default=None) evals_result: dict or None, optional (default=None)
This dictionary used to store all evaluation results of all the items in ``valid_sets``. This dictionary used to store all evaluation results of all the items in ``valid_sets``.
......
...@@ -328,7 +328,7 @@ class LGBMModel(_LGBMModelBase): ...@@ -328,7 +328,7 @@ class LGBMModel(_LGBMModelBase):
In either case, the ``metric`` from the model parameters will be evaluated and used as well. In either case, the ``metric`` from the model parameters will be evaluated and used as well.
early_stopping_rounds : int or None, optional (default=None) early_stopping_rounds : int or None, optional (default=None)
Activates early stopping. The model will train until the validation score stops improving. Activates early stopping. The model will train until the validation score stops improving.
If there's more than one, will check all of them. If there's more than one, will check all of them except the training data.
Validation error needs to decrease at least every ``early_stopping_rounds`` round(s) Validation error needs to decrease at least every ``early_stopping_rounds`` round(s)
to continue training. to continue training.
verbose : bool, optional (default=True) verbose : bool, optional (default=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment