skfolio.uncertainty_set.CompactCovarianceUncertaintySet#

class skfolio.uncertainty_set.CompactCovarianceUncertaintySet(radius, metric_sqrt, basis)[source]#

Compact representation of a quadratic covariance uncertainty penalty.

This object stores the data needed to evaluate a worst-case variance penalty in reduced projection form, without materializing the equivalent dense positive semidefinite matrix.

Let \(C\) be a diagonal metric square root and let \(Q\) be an orthonormal basis. For portfolio weights \(w\), the optimizer evaluates

\[\kappa \min_z \lVert C w - Q z \rVert_2^2.\]

This is equivalent to adding the following positive semidefinite matrix to the quadratic variance term:

\[\kappa C^\top (I - Q Q^\top) C.\]

The compact representation avoids building this dense matrix. The optimizer only needs the diagonal entries of \(C\) and the basis \(Q\).

Parameters:
radiusfloat

Non-negative multiplier \(\kappa\) applied to the quadratic covariance penalty.

metric_sqrtndarray of shape (n_assets,)

Diagonal of the metric square root \(C\).

basisndarray of shape (n_assets, rank)

Orthonormal basis \(Q\) of the subspace projected out by the quadratic penalty.

Attributes:
radiusfloat

Non-negative multiplier \(\kappa\).

metric_sqrtndarray of shape (n_assets,)

Diagonal of the metric square root \(C\).

basisndarray of shape (n_assets, rank)

Orthonormal basis \(Q\).