eqdisco.optimize.fit_parameters#

eqdisco.optimize.fit_parameters(expr, X, y, theta0=None, method='lm', max_iter=100, sample_weight=None, restarts=0, random_state=None, bounds=None)[source]#

Nonlinear least-squares estimate of the parameters \(\boldsymbol\theta\).

Minimizes \(\sum_k (y_k - f(\mathbf{x}_k;\boldsymbol\theta))^2\) with scipy.optimize.least_squares() using the analytic Jacobian of Expression.jacobian().

Parameters:
exprExpression
X, yarray_like
theta0array_like, optional

Start values (default: the stored parameters).

method{“lm”, “trf”}

Levenberg–Marquardt (default) or trust-region reflective (needed with bounds).

max_iterint

Maximum number of function evaluations per start, as a multiple of the number of parameters (max_nfev = max_iter * (p + 1)).

restartsint

Additional random starts around theta0; the best solution is kept.

boundstuple of arrays, optional

Box constraints on the parameters (requires method="trf").

Returns:
FitResult

The parameters, the final cost (half the residual sum of squares), a success flag, the number of evaluations and the updated expression. If the optimizer fails, the start values are returned with success=False.