TotalLeastSquaresSolver#
- class TotalLeastSquaresSolver(lapack_driver: str = 'gesdd')[source]#
Solve the total least-squares problem without any regularization, i.e.,
\[\argmin_{\Ohat} \left\|[~\Delta_\D~~\Delta_{\Z\trp}~]\right\|_{F}^{2} \quad\text{such that}\quad (\D + \Delta_\D)\Ohat\trp = \Z\trp + \Delta_{\Z\trp}.\]The solution is computed via the singular value decomposition of the augmented \(k \times (d + r)\) matrix \([~\D~~\Z\trp~]\): if \(\bfPhi\bfSigma\bfPsi\trp = [~\D~~\Z\trp~]\), write the \((d + r) \times (d + r)\) right singular vector matrix \(\bfPsi\) as
\[\begin{split}\bfPsi = \left[\begin{array}{cc} \bfPsi_{\D\D} & \bfPsi_{\D\Z} \\ \bfPsi_{\Z\D} & \bfPsi_{\Z\Z} \end{array}\right],\end{split}\]where \(\bfPsi_{\D\D}\) is \(d \times d\), \(\bfPsi_{\D\Z}\) is \(d \times r\), \(\bfPsi_{\Z\D}\) is \(r \times d\), and \(\bfPsi_{\Z\Z}\) is \(r \times r\). Then the optimal solution is given by \(\Ohat = -\bfPsi_{\Z\Z}^{-\mathsf{T}}\bfPsi_{\D\Z}\trp\).
- Parameters:
- lapack_driverstr
LAPACK routine for computing the SVD. See
scipy.linalg.svd()
.
Properties:- augcond#
\(2\)-norm condition number of the augmented data matrix \([~\D~~\Z\trp~]\).
- 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\).
- error#
Frobenius norm of the error matrices, \(\|[~\Delta_\D~~\Delta_{\Z\trp}~\|_F\).
- 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()
.
- 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.
Verify dimensions, compute the singular value decomposition of the data matrix, and solve the 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.
Return the total least-squares solution to the Operator Inference regression.
Verify the solver.