Parameter estimation#

Parameter estimation for symbolic models.

  • linear_scaling() – the closed-form intercept and slope of Keijzer (2003), which make the search insensitive to the scale and offset of the target;

  • lstsq() – (ridge-)regularized linear least squares for linear-in-parameters models;

  • fit_parameters() – nonlinear least squares (Levenberg–Marquardt or trust-region reflective) with the exact forward-mode Jacobian of the expression;

  • jacobian_rank() and redundant_parameters() – numerical rank of the Jacobian, which reveals over-parameterized expressions (Kronberger and de França, 2025).

Examples#

>>> import numpy as np
>>> from eqdisco.expr import Expression
>>> from eqdisco.optimize import fit_parameters
>>> rng = np.random.default_rng(0)
>>> X = rng.uniform(0, 2, size=(50, 1))
>>> y = 3.0 * np.exp(-0.7 * X[:, 0])
>>> e = Expression.from_string("1.0*exp(-1.0*x0)")
>>> res = fit_parameters(e, X, y)
>>> np.round(res.theta, 3)
array([ 3. , -0.7])

Linear scaling, least squares and Levenberg–Marquardt fitting with analytic Jacobians.

Classes#

FitResult(theta, cost, success, n_iter, ...)

Result of fit_parameters().

Functions#

linear_scaling(f, y[, sample_weight])

Optimal intercept \(a\) and slope \(b\) of \(a + b f\) in least squares.

lstsq(Phi, y[, ridge, intercept, sample_weight])

Least-squares weights of a linear-in-parameters model.

fit_parameters(expr, X, y[, theta0, method, ...])

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

jacobian_rank(expr, X[, theta, rtol])

Numerical rank of the Jacobian \(\partial f/\partial\boldsymbol\theta\) on X.

redundant_parameters(expr, X[, theta, rtol])

Indices of parameters that can be removed without reducing the Jacobian rank.