TruncatedSVDSolver#
- class TruncatedSVDSolver(num_svdmodes: int, lapack_driver: str = 'gesdd')[source]#
Solve the Frobenius-norm ordinary least-squares problem with a low-rank best approximation of the data matrix.
That is, solve
\[\argmin_{\Ohat}\|\tilde{\D}\Ohat\trp - \Z\trp\|_{F}^{2}\]where \(\tilde{\D}\) is the best rank-\(d'\) approximation of \(\D\) for a given \(d' \le \operatorname{rank}(\D)\), i.e.,
\[\tilde{\D} = \argmin_{\D' \in \RR^{k \times d}}\|\D' - \D\|_{F} \quad\textrm{such that}\quad \operatorname{rank}(\D') = d'.\]If \(\D = \bfPhi\bfSigma\bfPsi\trp\) is the singular value decomposition of \(\D\), then defining
\[\bfPhi' = \bfPhi_{:d', :} \quad \bfSigma' = \bfSigma_{:d', :d'} \quad \bfPsi' = \bfPsi_{:d', :},\]the solution to this problem is given by \(\Ohat\trp = \bfPsi'(\bfSigma')^{-1}(\bfPhi')\trp\Z\trp\) (i.e., \(\Ohat = \Z\bfPhi'(\bfSigma')^{-1}(\bfPsi')\trp\)).
- Parameters:
- num_svdmodesint or None
Number of singular value decomposition modes to retain. If
None
, use all available modes (no truncation). If a negative integer, usek - abs(num_svdmodes)
modes wherek
is the number of available modes.- 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\).
- max_modes#
Maximum number of singular value decomposition modes available.
- num_svdmodes#
Number of singular value decomposition modes to retain.
- 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\))
Methods:Compute the \(2\)-norm condition number of the data matrix \(\D\).
Make a copy of the solver.
Save data matrices and prepare to solve the regression problem.
Load a serialized solver from an HDF5 file, created previously from the
save()
method.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.
Compute the \(2\)-norm condition number of \(\tilde{\D}\), the low-rank approximation to \(\D\) from the truncated SVD.
Verify the solver.