cherab.phix.inversion.SVDInversionBase#
- class cherab.phix.inversion.SVDInversionBase(s, u, vh, data, inversion_base_vectors=None, L_inv=None)[source]#
Bases:
objectBase class for inversion calculation based on singular value decomposition (eco algorithum i.e. not full matrices of
u,vh).This provides users useful tools for regularization computation using SVD components. The estimated solution \(x_\lambda\) is defined by the following linear equation:
\[Ax = b,\]where \(A\) is a \(M \times N\) matrix. Adding the regularization term, the estimated solution \(x_\lambda\) is derived from the following equation:
\[ \begin{align}\begin{aligned}x_\lambda :&= \text{argmin} \{ ||Ax-b||^2 + \lambda ||L(x - x_0)||^2 \} \\\ &= ( A^\intercal A + \lambda L^\intercal L )^{-1} (A^\intercal\ b + \lambda L^\intercal Lx_0),\end{aligned}\end{align} \]where \(\lambda\) is the reguralization parameter, \(L\) is a matrix operator in regularization term (e.g. laplacian) and \(x_0\) is a prior assumption.
The SVD components are based on the following equation:
\[U\Sigma V^\intercal = (u_1, u_2, ...) \cdot \text{diag}(\sigma_1, \sigma_2,...) \cdot (v_1, v_2, ...)^\intercal = AL^{-1}\]Using this components, The \(x_\lambda\) can be reconstructed as follows:
\[x_\lambda = \sum_{i=0}^{K} w_i(\lambda)\frac{u_i \cdot b}{\sigma_i} L^{-1} v_i, \quad (K \equiv \min(M, N)),\]\(w_i\) is defined as follows:
\[w_i \equiv \frac{1}{1 + \lambda / \sigma_i^2}.\]- Parameters:
s (vector_like) – singular values \(\sigma_i\) in \(s\) vectors.
u (array_like) – SVD left singular vectors forms as one matrix like \(u = (u_1, u_2, ...)\)
vh (array_like) – SVD right singular vectors forms as one matrix like \(vh = (v_1, v_2, ...)^T\)
data (vector_like) – given data for inversion calculation
inversion_base_vectors (array-like, optional) – The components of inversions base represented as
L_inv @ vh.T. This property is offered to speed up the calculation of inversions. If None, it is automatically computed when calculating the inverted solution.L_inv (array_like, optional) – inversion matrix in the regularization term.
L_invis \(L^{-1}\) in \(||L(x - x_0)||^2\)
Methods
eta([beta])Calculate squared regularization norm \(\eta = ||L(x - x_0)||^2\)
eta_diff([beta])Calculate differential of
etaby regularization parameter.inverted_solution([beta])Calculate the inverted solution using given regularization parameter.
regularization_norm([beta])Return the residual norm \(\sqrt{\eta} = ||L (x - x_0)||\)
residual_norm([beta])Return the residual norm \(\sqrt{\rho} = ||Ax - b||\)
rho([beta])Calculate squared residual norm \(\rho = ||Ax - b||^2\).
w([beta])Calculate window function using regularization parameter as a valuable and using singular values.
Attributes
Inversion matrix in the regularization term.
Regularization parameter.
Given data for inversion calculation.
The components of inversions base represented as
L_inv @ vh.T.singular values \(\sigma_i\) in \(s\) vectors.
SVD left singular vectors forms as one matrix like \(u = (u_1, u_2, ...)\)
SVD right singular vectors forms as one matrix like \(vh = (v_1, v_2, ...)^T\)
- eta(beta=None)[source]#
Calculate squared regularization norm \(\eta = ||L(x - x_0)||^2\)
- Parameters:
beta (float | None) – regularization parameter, by default
self._beta- Returns:
squared regularization norm
- Return type:
- eta_diff(beta=None)[source]#
Calculate differential of
etaby regularization parameter.- Parameters:
beta (float | None) – regularization parameter, by default
self._beta- Returns:
differential of squared regularization norm
- Return type:
- inverted_solution(beta=None)[source]#
Calculate the inverted solution using given regularization parameter.
- Parameters:
beta (float | None) – regularization parameter, by default None
- Returns:
solution vector
- Return type:
- rho(beta=None)[source]#
Calculate squared residual norm \(\rho = ||Ax - b||^2\).
- Parameters:
beta (float | None) – regularization parameter, by default None
- Returns:
squared residual norm
- Return type:
- w(beta=None)[source]#
Calculate window function using regularization parameter as a valuable and using singular values.
- Parameters:
beta (float | None) – regularization parameter, by default None
- Returns:
window function \(\frac{1}{1 + \lambda / \sigma_i^2}\)
- Return type:
numpy.ndarray (N, )
- property L_inv: NDArray[float64] | None#
Inversion matrix in the regularization term.
L_invis \(L^{-1}\) in \(||L(x - x_0)||^2\), by defaultnumpy.identity(self._vh.shape[1])
- property inversion_base_vectors: NDArray[float64] | None#
The components of inversions base represented as
L_inv @ vh.T. This property is offered to speed up the calculation of inversions. If None, it is automatically computed when calculating the inverted solution.- Type:
array_like or None if not set
- property s: ndarray[Any, dtype[float64]]#
singular values \(\sigma_i\) in \(s\) vectors.
- Type:
vector_like