gammy.utils.decompose_covariance

decompose_covariance

decompose_covariance(H, energy: float = 1.01)numpy.ndarray[source]

Most important eigenvectors of a symmetric positive-definite square matrix

Ordered with respect of the descending eigenvalues. Each eigenvector scaled with sqrt(λ). For theoretical justification, see the section on Gaussian Processes in the package documentation.

NOTE: In the implementation we use np.linalg.svd instead of np.linalg.eigh because the latter sometimes returns slightly negative eigenvalues for numerical reasons. In those cases the energy trick doesn’t give all eigenvectors even if we wanted

REVIEW: There might be problem with serialization. If there are duplicate eigenvalues, then on different machines, the vectors might appear in different order.

Parameters
Hnp.ndarray

Symmetric positive-definite square matrix

energyfloat

Truncate to eigenvalues that sum up to this proportion of the total eigenvalue sum. If absolutelu all eigenvectors are needed, give value slightly larger than one.