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, use k - abs(num_svdmodes) modes where k 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:

cond

Compute the \(2\)-norm condition number of the data matrix \(\D\).

copy

Make a copy of the solver.

fit

Save data matrices and prepare to solve the regression problem.

load

Load a serialized solver from an HDF5 file, created previously from the save() method.

residual

Compute the residual of the \(2\)-norm regression objective for each row of the given operator matrix.

save

Serialize the solver, saving it in HDF5 format.

solve

Solve the Operator Inference regression.

tcond

Compute the \(2\)-norm condition number of \(\tilde{\D}\), the low-rank approximation to \(\D\) from the truncated SVD.

verify

Verify the solver.