L2DecoupledSolver#
- class L2DecoupledSolver(regularizer, lapack_driver: str = 'gesdd')[source]#
Solve \(r\) independent \(2\)-norm ordinary least-squares problems, each with the same data matrix but a different \(L_2\) regularization.
That is, for \(i = 1, \ldots, r\), construct \(\Ohat\) by solving
\[\argmin_{\Ohat}\|\D\ohat_i - \z_i\|_2^2 + \|\lambda_i\Ohat_i\|_2^2\]where \(\ohat_i\) and \(\z_i\) are the \(i\)-th rows of \(\Ohat\) and \(\Z\), respectively, with corresponding regularization constant \(\lambda_i > 0\).
The exact solution for the \(i\)-th problem is described by the normal equations:
\[(\D\trp\D + \lambda_i^2\I)\ohat_i = \D\trp\z_i.\]Instead of solving these equations directly, the solution is calculated using the singular value decomposition of the data matrix (see
L2Solver
).- Parameters:
- regularizer(r,) ndarray
Scalar \(L_2\) regularization constants, one for each row of the operator matrix.
- lapack_driverstr
LAPACK routine for computing the singular value decomposition. See
scipy.linalg.svd()
.
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\).
- options#
Keyword arguments for
scipy.linalg.svd()
. These cannot be changed after instantiation.
- r#
Number of operator matrix rows to learn (number of rows of \(\Z\) and \(\Ohat\))
- regularizer#
Scalar \(L_2\) regularization constants, one for each row of the operator matrix \(\Ohat\).
Methods:Compute the \(2\)-norm condition number of the data matrix \(\D\).
Make a copy of the solver.
Verify dimensions and compute the singular value decomposition of the data matrix in preparation to solve the least-squares problem.
Load a serialized solver from an HDF5 file, created previously from the
save()
method.Compute the \(2\)-norm condition number of each regularized data matrix, \([~\D\trp~~\lambda_i\I~]\trp\) for \(i = 1, \ldots, r\).
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.