freealg.AlgebraicForm.fit#

AlgebraicForm.fit(deg_m, deg_z, reg=0.0, r=[1.25, 6.0, 20.0], n_r=[3, 2, 1], n_samples=4096, y_eps=0.02, x_pad=0.0, triangular=None, mu='auto', mu_reg=None, normalize=True, verbose=False, return_info=False)#

Fit an algebraic structure to the input data.

Parameters:
deg_mint

\(\mathrm{deg}_m(P)\): egree polynomial \(P(z, m)\) in \(m\).

deg_zint

\(\mathrm{deg}_z(P)\): degree polynomial \(P(z, m)\) in \(z\).

regfloat, default=0.0

Tikhonov regularization parameter for fitting.

triangular{'upper', 'lower', 'antidiag'}, or None, default=None

The index set \(\mathcal{A}\) of the polynomial coefficients

  • 'upper': Upper triangular matrix of coefficients

  • 'lower': Lower triangular matrix of coefficients

  • 'antidiag': Anti-diagonal matrix of coefficients

  • None: Full matrix

muarray_like, default= 'auto'

Constraint to fit polynomial coefficients based on moments:

  • If an array \([\mu_0, \mu_1\), dots, mu_r]` is given, it enforces the first \(r+1\) moments. Note that \(\mu_0 = 1\) to ensure unit mass.

  • If instead this option is set to 'auto', and the input A is a matrix, it automatically uses the first two moments of the eigenvalues of the input matrix as moment constraints.

  • If None, no constraint is used.

See also mu_reg.

mu_reg: float, default=None

If None, the constraints mu are applied as hard constraint. If a positive number, the constraints are applied as a soft constraints with regularisation mu_reg.

normalizebool, default=True

If True, the coefficients are scaled so that coeff[0, 0] = 1. This improves the conditioning of the coefficients.

verbosebool, default=False

If True, debugging info is printed.

return_infobool, default=False

If True, debugging info is also returned.

Returns:
coeffsnumpy.ndarray

2D array of polynomial coefficients

infodict

If return_info = True, a dictionary of debugging info is also returned.

See also

support

Notes

When the input data are from an exact model, hard moment constraint is preferred over soft constraint as the latter can hurt an already a good fit.