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:
For the map matrix, this is :
with the matrix with eigenvectors,
a diagonal matrix
with the eigenvalues on the diagonal,
the identity matrix and
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
is a
diagonal matrix.
Value
a numeric matrix representing either the hat matrix
(eigen2hat
), the map matrix (eigen2map
) or
the original matrix (eigen2matrix
)