Basis.diagonalize_penalty()#
- Basis.diagonalize_penalty(atol=1e-06)[source]#
Diagonalize the penalty via an eigenvalue decomposition.
This method computes a transformation that diagonalizes the penalty matrix and updates the internal basis function such that subsequent evaluations use the accordingly transformed basis. The penalty is updated to the diagonalized version.
- Parameters:
atol (
float, default:1e-06) – Absolute tolerance used in testing whether the existing penalty is already diagonal. If that is the case, the basis instance is returned without any further changes.- Return type:
Self- Returns:
The modified basis instance (self).
Notes
Penalty diagonalization works via an eigenvalue decomposition of the penalty matrix. Let the eigenvalue decomposition of the \(d \times d\) penalty matrix \(\mathbf{K}\) be given by
\[\mathbf{K} = \mathbf{U} \boldsymbol{\Lambda} \mathbf{U}^\top,\]where \(\boldsymbol{\Lambda} = \operatorname{diag}(\lambda_1, \dots, \lambda_d)\) contains the eigenvalues of \(\mathbf{K}\) in decreasing order and \(\mathbf{U}\) the corresponding eigenvectors. Let \(r\) denote the rank of \(\mathbf{K}\).
The function obtains a reparameterization matrix \(\mathbf{Z}\) as
\[\mathbf{Z} = \mathbf{U} \boldsymbol{\Lambda}^{-1/2},\]where \(\boldsymbol{\Lambda}^{-1/2} = \operatorname{diag}(\lambda_1^{-1/2}, \dots, \lambda_r^{-1/2}, \mathbf{0}_{d-r}^\top)\). The element \(\mathbf{0}_{d-r}^\top\) is a zero-vector of length \(d-r\), corresponding to the zero eigenvalues of the penalty matrix.
The basis matrix \(\mathbf{B}\) is then updated as \(\mathbf{B}_Z = \mathbf{B} \mathbf{Z}\), and the penalty matrix is updated to \(\operatorname{diag}(\mathbf{1}_{r}^\top, \mathbf{0}_{d-r}^\top)\).
The basis function is likewise updated to evaluate to the reparamterized basis matrix during prediction.
References
Kneib, T., Klein, N., Lang, S., & Umlauf, N. (2019). Modular regression—A Lego system for building structured additive distributional regression models with tensor product interactions. TEST, 28(1), 1–39. https://doi.org/10.1007/s11749-019-00631-z