skfolio.utils.stats.squared_standardized_euclidean_dist#
- skfolio.utils.stats.squared_standardized_euclidean_dist(returns, covariance)[source]#
Squared standardized Euclidean distance.
\[d^2 = \sum_i (r_i\,/\,\sigma_i)^2\]This is the squared Mahalanobis distance using only the diagonal of the covariance matrix (ignoring correlations).
- Parameters:
- returnsndarray of shape (n_assets,)
Asset return vector.
- covariancendarray of shape (n_assets, n_assets)
Covariance matrix.
- Returns:
- float
Sum of squared standardized returns (non-negative). Under correct calibration: \(\mathbb{E}[d^2] = n_{\text{assets}}\).