nlsq.callbacks.EarlyStopping¶
- class nlsq.callbacks.EarlyStopping(patience=10, min_delta=1e-06, verbose=True)[source]¶
Bases:
CallbackBaseStop optimization early if no improvement for patience iterations.
- Parameters:
Examples
>>> from nlsq.callbacks import EarlyStopping >>> callback = EarlyStopping(patience=5, min_delta=1e-4) >>> popt, pcov = curve_fit(f, x, y, callback=callback)
Notes
Raises StopOptimization exception when patience is exceeded, which will be caught by the optimizer and treated as successful convergence.