Quadratic

The Quadratic model sets up and solves the Ridge (or Tikhonov) least squares problem:

$$\text{minimize } || Ax+\eta-b ||_2 + \alpha || \Delta x_i ||_2$$ $$\text{subject to } x_i \ge 0$$

where A is the a basis matrix, b is an observation, x is a vector of coefficients, and eta is a constant background term. Alpha is a hyperparameter that specifies the weight given to the smoothness regularization term.

Quadratic first factorizes the problem into it’s quadratic form

$$\text{minimize } x^T(A^TA + \alpha^2D^TD)x - 2(A^Tb)^T + b^Tb $$

before sending the problem to cvxpy. This results in faster solving times at the cost of performing the matrix multiplication required by the first term.

class kemitter.model.Quadratic(alpha)

Solves and stores results of cvxpy ridge regression solver, posed in its quadratic form.

name

str – “QUADRATIC” (constant)

alpha

float – the regularization parameter for the smoothness penalty

cache

ndarray – A cached 2D (A^T*A) array from a previous calculation (used for repeated fits).

See also

Model

run(bases, observation, verbose=True, caching=False)

Runs the model calculations.

Bases and observations are loaded into proper polarized data sets. In this step, arguments are checked to ensure polarization angles match in value and order. Any bases that have not been built already are built with their corresponding build() method.

Bases and observations of multiple polarizations are then concatenated and given to cvxpy and MOSEK for solving.

The problem is first factorized into its quadratic form by performing the matrix multiplication (A^T*A). This is an expensive operation that comes with the benefit of much faster solving times. For repeated fits (for example, fits of multiple frames with the same bases), this resulting matrix can be cached to avoid repetitive recalculations.

Results are returned and processed in inherited Model attributes.

Parameters:
  • bases (list of Basis) – The basis objects (built or not) of several polarizations, to be used for fitting.
  • observation (list of Observation) – The observation objects of several polarizations, to be used for fitting.
  • verbose (bool) – The console verbosity of the called solver (MOSEK) [default True].
  • caching (bool) – Whether or not to use or store the resulting basis-matrix multiplication [default False].