skfolio.metrics.diagonal_calibration_loss#
- skfolio.metrics.diagonal_calibration_loss(estimator, X_test, y=None)[source]#
Diagonal calibration loss.
Computes the absolute deviation of
diagonal_calibration_ratiofrom its calibration target of1.0.Let \(r_t\) be the one-period realized return vector at time \(t\), and let \(R^{(h)} = \sum_{t=1}^{h} r_t\) be the aggregated return over an evaluation window of \(h\) observations.
\[\ell = \left\lvert \frac{1}{n}\sum_{i=1}^{n} \frac{(R_i^{(h)})^2}{h\,\sigma_i^2} - 1 \right\rvert\]where \(n\) is the number of assets.
- 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.
- Returns:
- float
Calibration loss. Lower values are better and the optimum is
0.0.
See also
diagonal_calibration_ratioThe underlying calibration ratio.
mahalanobis_calibration_lossLoss using the full covariance structure.