Kron2SumCov¶
- class glimix_core.cov.Kron2SumCov(G, dim, rank)[source]¶
Implements K = C₀ ⊗ GGᵀ + C₁ ⊗ I.
C₀ and C₁ are d×d symmetric matrices. C₀ is a semi-definite positive matrix while C₁ is a positive definite one. G is a n×m matrix and I is a n×n identity matrix. Let M = Uₘ Sₘ Uₘᵀ be the eigen decomposition for any matrix M. The documentation and implementation of this class make use of the following definitions:
X = GGᵀ = Uₓ Sₓ Uₓᵀ
C₁ = U₁ S₁ U₁ᵀ
Cₕ = S₁⁻½ U₁ᵀ C₀ U₁ S₁⁻½
Cₕ = Uₕ Sₕ Uₕᵀ
D = (Sₕ ⊗ Sₓ + Iₕₓ)⁻¹
Lₓ = Uₓᵀ
Lₕ = Uₕᵀ S₁⁻½ U₁ᵀ
L = Lₕ ⊗ Lₓ
The above definitions allows us to write the inverse of the covariance matrix as:
K⁻¹ = LᵀDL,
where D is a diagonal matrix.
Example
>>> from numpy import array >>> from glimix_core.cov import Kron2SumCov >>> >>> G = array([[-1.5, 1.0], [-1.5, 1.0], [-1.5, 1.0]]) >>> Lr = array([[3], [2]], float) >>> Ln = array([[1, 0], [2, 1]], float) >>> >>> cov = Kron2SumCov(G, 2, 1) >>> cov.C0.L = Lr >>> cov.C1.L = Ln >>> print(cov) Kron2SumCov(G=..., dim=2, rank=1): Kron2SumCov LRFreeFormCov(n=2, m=1): C₀ L: [[3.] [2.]] FreeFormCov(dim=2): C₁ L: [[1. 0.] [2. 1.]]
Methods
LdKL_dot
(v)Implements L(∂K)Lᵀv.
__init__
(G, dim, rank)Constructor.
gradient
()Gradient of K.
gradient_dot
(v)Implements ∂K⋅v.
listen
(func)Listen to parameters change.
logdet
()Implements log|K| = - log|D| + n⋅log|C₁|.
logdet_gradient
()Implements ∂log|K| = Tr[K⁻¹∂K].
solve
(v)Implements the product K⁻¹⋅v.
value
()Covariance matrix K = C₀ ⊗ GGᵀ + C₁ ⊗ I.
Attributes
C0
Semi-definite positive matrix C₀.
C1
Definite positive matrix C₁.
D
(Sₕ ⊗ Sₓ + Iₕₓ)⁻¹.
G
User-provided matrix G, n×m.
Ge
Result of US from the SVD decomposition G = USVᵀ.
Lh
Lₕ.
Lx
Lₓ.
name
Name of this function.
nparams
Number of parameters.