nlsq.callbacks.IterationLogger¶
- class nlsq.callbacks.IterationLogger(filename=None, mode='w', log_params=False, file=None)[source]¶
Bases:
CallbackBaseLog optimization progress to file or stdout.
- Parameters:
filename (str, optional) – File to log to. If None and file is None, logs to stdout.
mode (str, optional) – File open mode. Default: ‘w’ (overwrite)
log_params (bool, optional) – Whether to log parameter values. Default: False
file (file-like object, optional) – File-like object to write to. If provided, filename is ignored.
Examples
>>> from nlsq.callbacks import IterationLogger >>> callback = IterationLogger("optimization.log") >>> popt, pcov = curve_fit(f, x, y, callback=callback)