piglot.optimiser.StoppingCriteria
- class StoppingCriteria(conv_tol: float | None = None, max_iters_no_improv: int | None = None, max_func_calls: int | None = None, max_timeout: float | None = None)[source]
Bases:
objectImplements different stopping criteria.
Attributes
- conv_tolfloat
Stop the optimiser if the loss becomes small than this value.
- max_iters_no_improvint
Stop the optimiser if the loss does not improve after this number of iterations in a row.
- max_func_callsint
Stop the optimiser after this number of function calls.
- max_timeoutfloat
Stop the optimiser after this elapsed time (in seconds).
Methods
- check_criteria(loss_value, iters_no_improv, func_calls):
check the status of the stopping criteria.
Methods
Check the status of the stopping criteria.
Read the stopping criteria from the configuration dictionary.
- check_criteria(loss_value: float, iters_no_improv: int, func_calls: int, elapsed: float) bool[source]
Check the status of the stopping criteria.
Parameters
- loss_valuefloat
Current loss value.
- iters_no_improvint
Current number of iterations without improvement.
- func_callsint
Current number of function calls.
- elapsedfloat
Elapsed time in seconds.
Returns
- bool
Whether any of the criteria are satisfied.