skfolio.metrics.portfolio_variance_calibration_loss#
- skfolio.metrics.portfolio_variance_calibration_loss(estimator, X_test, y=None, portfolio_weights=None)[source]#
Portfolio variance calibration loss.
Computes the absolute deviation of
portfolio_variance_calibration_ratiofrom its calibration target of1.0.Let \(r_t\) be the one-period realized return vector at time \(t\) and \(w^\top r_t\) the corresponding one-period portfolio return for weights \(w\).
\[\ell = \left\lvert \frac{\sum_{t=1}^{h} (w^\top r_t)^2} {h\, w^\top \Sigma\, w} - 1 \right\rvert\]When multiple portfolios are provided, the loss is the absolute deviation of the mean ratio from
1.0.- Parameters:
- estimatorBaseEstimator
Fitted estimator, must expose
covariance_orreturn_distribution_.covariance.- X_testarray-like of shape (n_observations, n_assets)
Realized returns for the test window.
- yIgnored
Present for scikit-learn API compatibility.
- portfolio_weightsarray-like of shape (n_assets,) or (n_portfolios, n_assets), optional
Portfolio weights. If
None(default), inverse-volatility weights are used, which neutralizes volatility dispersion so that high-volatility assets do not dominate the diagnostic. If a 2D array is provided, each row defines a test portfolio. For equal-weight calibration, passportfolio_weights=np.ones(n_assets) / n_assets.
- Returns:
- float
Calibration loss. Lower values are better and the optimum is
0.0.
See also
portfolio_variance_calibration_ratioThe underlying calibration ratio.
portfolio_variance_qlike_lossQLIKE loss for the projected portfolio variance.