eigen2hat {xnet} | R Documentation |
Calculate the hat matrix from an eigen decomposition
Description
These functions calculate either the hat matrix, the mapping matrix or the original (kernel) matrix for a two-step kernel ridge regression, based on the eigendecomposition of the kernel matrix.
Usage
eigen2hat(eigen, val, lambda)
eigen2map(eigen, val, lambda)
eigen2matrix(eigen, val)
Arguments
eigen |
a matrix with the eigenvectors. |
val |
an numeric vector with the eigenvalues. |
lambda |
a single numeric value for the hyperparameter lambda |
Details
For the hat matrix, this boils down to:
U\Sigma(\Sigma + \lambda I)^{-1} U^{T}
For the map matrix, this is :
U(\Sigma + \lambda I)^{-1} U^{T}
with U
the matrix with eigenvectors, \Sigma
a diagonal matrix
with the eigenvalues on the diagonal, I
the identity matrix and
\lambda
the hyperparameter linked to this kernel.
The internal calculation is optimized to avoid having to invert
a matrix. This is done using the fact that \Sigma
is a
diagonal matrix.
Value
a numeric matrix representing either the hat matrix
(eigen2hat
), the map matrix (eigen2map
) or
the original matrix (eigen2matrix
)