Skip to content

Commit

Permalink
Resolve dimension issue for contributive_correlation
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloLepelaars committed Jan 4, 2024
1 parent daf335e commit 6e944ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions numerblox/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from scipy import stats
from tqdm.auto import tqdm
import matplotlib.pyplot as plt
from typing import Tuple, List, Callable, Dict, Any, Union
from typing import Tuple, List, Dict, Any, Union
from numerapi import SignalsAPI
from joblib import Parallel, delayed
from numerai_tools.scoring import correlation_contribution
Expand Down Expand Up @@ -799,7 +799,7 @@ def legacy_contribution(

def contributive_correlation(
self, dataf: pd.DataFrame, pred_col: str, target_col: str, other_col: str
) -> List[np.float64]:
) -> np.array:
"""Calculate the contributive correlation of the given predictions
wrt the given meta model.
see: https://docs.numer.ai/numerai-tournament/scoring/meta-model-contribution-mmc-and-bmc
Expand All @@ -822,15 +822,15 @@ def contributive_correlation(
If the function is called from full_evalation, this is guaranteed because of the checks.
:param other_col: Meta model column containing predictions to neutralize against.
:return: List of contributive correlations by era.
:return: A 1D NumPy array of contributive correlations by era.
"""
mc_scores = []
for _, x in dataf.groupby(self.era_col):
mc = correlation_contribution(x[[pred_col]],
x[other_col],
x[target_col])
mc_scores.append(mc)
return mc_scores
return np.array(mc_scores).ravel()

def check_custom_functions(self):
if not isinstance(self.custom_functions, dict):
Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "numerblox"
version = "1.1.14"
version = "1.1.15"
description = "Solid Numerai Pipelines"
authors = ["CrowdCent <support@crowdcent.com>"]
license = "MIT License"
Expand Down

0 comments on commit 6e944ed

Please sign in to comment.