TikhonovSolver#
- class TikhonovSolver(regularizer, method: str = 'lstsq', cond: float = None, lapack_driver: str = None)[source]#
Solve the Frobenius-norm ordinary least-squares problem with Tikhonov regularization.
That is, solve
\[\argmin_{\Ohat}\|\D\Ohat\trp - \Z\trp\|_F^2 + \|\bfGamma\Ohat\trp\|_F^2\]for a specified symmetric-positive-definite regularization matrix \(\bfGamma \in \RR^{d \times d}\). This is equivalent to solving the following stacked least-squares problem:
\[\begin{split}\argmin_{\Ohat} \left\| \left[\begin{array}{c}\D \\ \bfGamma\end{array}\right]\Ohat\trp - \left[\begin{array}{c}\Z\trp \\ \0\end{array}\right] \right\|_F^2.\end{split}\]The exact solution is described by the normal equations:
\[(\D\trp\D + \bfGamma\trp\bfGamma)\Ohat\trp = \D\trp\Z\trp,\]that is,
\[\Ohat = \Z\D(\D\trp\D + \bfGamma\trp\bfGamma)^{-\mathsf{T}}.\]- Parameters:
- regularizer(d, d) or (d,) ndarray
Symmetric semi-positive-definite regularization matrix \(\bfGamma\) or, if
regularizer
is a one-dimensional array, the diagonal entries of \(\bfGamma\). Here,d
is the number of columns in the data matrix.- methodstr
Strategy for solving the regularized least-squares problem. Options:
"lstsq"
: solve the stacked least-squares problem viascipy.linalg.lstsq()
; by default, this computes and uses the singular value decomposition of the stacked data matrix \([~D\trp~~\bfGamma\trp~]\trp\)."normal"
: directly solve the normal equations \((\D\trp\D + \bfGamma\trp\bfGamma) \Ohat\trp = \D\trp\Z\trp\) viascipy.linalg.solve()
.
- condfloat or None
Cutoff for ‘small’ singular values of the data matrix, see
scipy.linalg.lstsq()
. Ignored ifmethod = "normal"
.- lapack_driverstr or None
Which LAPACK driver is used to solve the least-squares problem, see
scipy.linalg.lstsq()
. Ignored ifmethod = "normal"
.
Properties:- d#
Number of unknowns in each row of the operator matrix (number of columns of \(\D\) and \(\Ohat\)).
- data_matrix#
\(k \times d\) data matrix \(\D\).
- k#
Number of equations in the least-squares problem (number of rows of \(\D\) and number of columns of \(\Z\)).
- lhs_matrix#
\(r \times k\) left-hand side data \(\Z\).
- method#
Strategy for solving the regularized least-squares problem, either
"lstsq"
(default) or"normal"
.
- options#
Keyword arguments for
scipy.linalg.lstsq()
.
- r#
Number of operator matrix rows to learn (number of rows of \(\Z\) and \(\Ohat\))
- regularizer#
Symmetric semi-positive-definite \(d \times d\) regularization matrix \(\bfGamma\).
Methods:Compute the \(2\)-norm condition number of the data matrix \(\D\).
Make a copy of the solver.
Verify dimensions and precompute quantities in preparation to solve the least-squares problem.
Construct a regularizer so that each operator is regularized separately.
Load a serialized solver from an HDF5 file, created previously from the
save()
method.Compute the \(2\)-norm condition number of the regularized data matrix \([~\D\trp~~\bfGamma\trp~]\trp.\)
Compute the residual of the regularized regression objective for each row of the given operator matrix.
Compute the residual of the \(2\)-norm regression objective for each row of the given operator matrix.
Serialize the solver, saving it in HDF5 format.
Solve the Operator Inference regression.
Verify the solver.