skfolio.prior.CovarianceSqrt#
- class skfolio.prior.CovarianceSqrt(components=(), diagonal=None)[source]#
Matrix square root decomposition of a covariance matrix.
Encodes \(\Sigma = \sum_i A_i A_i^\top + \operatorname{diag}(d)^2\) in a form suitable for second-order cone (SOC) constraints:
\[\begin{split}\left\lVert \begin{pmatrix} A_1^\top w \\ \vdots \\ A_m^\top w \\ d \odot w \end{pmatrix} \right\rVert_2 \le v \;\Longleftrightarrow\; w^\top \Sigma\, w \le v^2\end{split}\]This representation avoids forming a full \((n \times n)\) Cholesky factor when the covariance has lower-dimensional components and a diagonal component.
- Attributes:
- componentstuple of ndarray of shape (n, k_i)
Matrices \(A_i\) of shape \((n, k_i)\) contributing \(\sum_i A_i A_i^\top\) to the covariance.
- diagonalndarray of shape (n,) or None
Vector \(d\) contributing \(\operatorname{diag}(d)^2\) to the covariance.