|
Medial Code Documentation
|
Data Structures | |
| class | EarlyStopException |
Functions | |
| _format_eval_result (value, show_stdv=True) | |
| print_evaluation (period=1, show_stdv=True) | |
| record_evaluation (eval_result) | |
| reset_parameter (**kwargs) | |
| early_stopping (stopping_rounds, verbose=True) | |
Variables | |
| CallbackEnv | |
Callbacks library.
|
protected |
Format metric string.
| lightgbm.callback.early_stopping | ( | stopping_rounds, | |
verbose = True |
|||
| ) |
Create a callback that activates early stopping.
Note
----
Activates early stopping.
The model will train until the validation score stops improving.
Validation score needs to improve at least every ``early_stopping_rounds`` round(s)
to continue training.
Requires at least one validation data and one metric.
If there's more than one, will check all of them. But the training data is ignored anyway.
Parameters
----------
stopping_rounds : int
The possible number of rounds without the trend occurrence.
verbose : bool, optional (default=True)
Whether to print message with early stopping information.
Returns
-------
callback : function
The callback that activates early stopping.
| lightgbm.callback.print_evaluation | ( | period = 1, |
|
show_stdv = True |
|||
| ) |
Create a callback that prints the evaluation results.
Parameters
----------
period : int, optional (default=1)
The period to print the evaluation results.
show_stdv : bool, optional (default=True)
Whether to show stdv (if provided).
Returns
-------
callback : function
The callback that prints the evaluation results every ``period`` iteration(s).
| lightgbm.callback.record_evaluation | ( | eval_result | ) |
Create a callback that records the evaluation history into ``eval_result``.
Parameters
----------
eval_result : dict
A dictionary to store the evaluation results.
Returns
-------
callback : function
The callback that records the evaluation history into the passed dictionary.
| lightgbm.callback.reset_parameter | ( | ** | kwargs | ) |
Create a callback that resets the parameter after the first iteration.
Note
----
The initial parameter will still take in-effect on first iteration.
Parameters
----------
**kwargs : value should be list or function
List of parameters for each boosting round
or a customized function that calculates the parameter in terms of
current number of round (e.g. yields learning rate decay).
If list lst, parameter = lst[current_round].
If function func, parameter = func(current_round).
Returns
-------
callback : function
The callback that resets the parameter after the first iteration.
| lightgbm.callback.CallbackEnv |