macrosynergy.learning.model_evaluation.scorers#

neg_mean_abs_corr(estimator, X_test, y_test, correlation_type='pearson')[source]#

Negative mean absolute correlation between a time series of benchmark returns and a panel of computed hedged returns, with average taken over all cross-sections.

Parameters:
  • estimator (BaseRegressionSystem) – A fitted scikit-learn regression object with separate linear models for each cross-section of returns, regressed against a time series of benchmark risk basket returns. It is expected to possess a coefs_ dictionary attribute with keys corresponding to the cross-sections of returns and values corresponding to the estimated coefficients of the linear model for each cross-section.

  • X_test (pd.DataFrame) – Risk-basket returns replicated for each cross-section of returns in y_test.

  • y_test (pd.Series) – Panel of financial contract returns.

  • correlation_type (str) – Type of correlation to compute between each hedged return series and the risk basket return series. Default is “pearson”. Alternatives are “spearman” and “kendall”.

Returns:

neg_mean_abs_corr – Negative mean absolute correlation between benchmark risk basket returns and computed hedged returns.

Return type:

float

Notes

For each cross-section \(c\) in X_test, hedged returns are calculated by subtracting \(X_{test, c} \cdot \text{coefs_}[c]\) from each y_{test, c}. Following this, the negative mean absolute correlation over cross-sections can be calculated:

`{math} :label: neg_mean_abs_corr \text{neg_mean_abs_corr} = - (1/C)\sum_{c=1}^{C} \left [ abs_corr_{c} \right ] `

This function is a specialised scorer to evaluate the quality of a hedge within the BetaEstimator class in the macrosynergy.learning subpackage.

Submodules#