pastas.solver.least_squares.LeastSquares#

class pastas.solver.least_squares.LeastSquares(name: str = 'solver', jac: Literal['2-point', '3-point', 'cs'] = '2-point', method: Literal['trf', 'dogbox', 'lm'] = 'trf', ftol: float = 1e-08, xtol: float = 1e-08, gtol: float = 1e-08, x_scale: float | Literal['jac'] | None = None, loss: Literal['linear', 'soft_l1', 'huber', 'cauchy', 'arctan'] = 'linear', f_scale: float = 1.0, max_nfev: int | None = None, diff_step: float | pastas.typing.ArrayLike | None = None, tr_solver: Literal['exact', 'lsmr'] | None = None, tr_options: dict | None = None, callback: collections.abc.Callable | None = None, pcov: pandas.DataFrame | None = None, **kwargs)#

Solver based on Scipy’s least_squares method [Virtanen et al., 2020].

Notes

This class is the default solve method called by the pastas Model solve method. All kwargs provided to the Model.solve() method are forwarded to the solver. From there, they are forwarded to Scipy least_squares solver.

Examples

>>> ml.solve(solver=ps.solver.LeastSquares())

References

https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.least_squares.html

Methods#

objfunction(→ pastas.typing.ArrayLike)

Objective function that is minimized by the least_squares solver.

solve(→ tuple[bool, pandas.DataFrame])

Solve method calling scipy.optimize.least_squares.

get_stderr(→ pandas.Series)

Calculate the standard error of the parameters from the covariance matrix.

get_covariances(→ pastas.typing.ArrayLike)

Calculate the covariance matrix from the jacobian.

fit_report(→ str)

Report on the fit after a model is optimized.

to_dict(→ dict)

Convert the solver settings to a dictionary.