numerai-tools 0.5.2.dev1__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: numerai-tools
3
- Version: 0.5.2.dev1
3
+ Version: 0.6.0
4
4
  Summary: A collection of open-source tools to help interact with Numerai, model data, and automate submissions.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python
16
16
  Classifier: Programming Language :: Python :: 3
17
17
  Classifier: Topic :: Scientific/Engineering
18
18
  Requires-Dist: numpy (>=2.0.0,<3.0.0)
19
- Requires-Dist: pandas (>=2.2.2,<3.0.0)
19
+ Requires-Dist: pandas (>=2.2.2,<4.0.0)
20
20
  Requires-Dist: scikit-learn (>=1.5.0,<2.0.0)
21
21
  Requires-Dist: scipy (>=1.13.0,<2.0.0)
22
22
  Project-URL: Documentation, https://docs.numer.ai/
@@ -365,7 +365,8 @@ def correlation_contribution(
365
365
  else:
366
366
  # multiply target and neutralized predictions
367
367
  # this is equivalent to covariance b/c mean = 0
368
- mmc = (live_targets @ neutral_preds) / len(live_targets)
368
+ target_values = cast(np.ndarray, live_targets.to_numpy())
369
+ mmc = (target_values @ neutral_preds) / len(live_targets)
369
370
  return pd.Series(mmc, index=predictions.columns)
370
371
 
371
372
 
@@ -391,7 +392,10 @@ def neutralize(
391
392
  assert not neutralizers.isna().any().any(), "Neutralizers contain NaNs"
392
393
  assert len(df.index) == len(neutralizers.index), "Indices don't match"
393
394
  assert (df.index == neutralizers.index).all(), "Indices don't match"
394
- df[df.columns[df.std() == 0]] = np.nan
395
+ zero_std_cols = df.columns[df.std() == 0]
396
+ if len(zero_std_cols) > 0:
397
+ df = df.copy()
398
+ df.loc[:, zero_std_cols] = np.nan
395
399
  df_arr = df.values
396
400
  neutralizer_arr = neutralizers.values
397
401
  neutralizer_arr = np.hstack(
@@ -665,5 +669,5 @@ def meta_portfolio_contribution(
665
669
 
666
670
  # Gradient: ∇_s α = (1 / ||v||) (R_v W_c)^T t_c
667
671
  mpc = (residualized_w.T @ t).squeeze() / l2_norm
668
-
672
+ mpc /= 50
669
673
  return pd.Series(mpc, index=stakes.index)
@@ -155,8 +155,7 @@ def _validate_ids(
155
155
  not submission[id_col].isna().any()
156
156
  ), f"invalid_submission_ids: Submission must not contain NaNs in the {id_col} column."
157
157
 
158
- index_sub = submission.copy()
159
- index_sub[id_col] = index_sub[id_col].astype(str)
158
+ index_sub = submission.assign(**{id_col: submission[id_col].astype(str)})
160
159
 
161
160
  live_ids = live_ids.astype(str)
162
161
  live_sub = index_sub[index_sub[id_col].isin(live_ids)].sort_values(id_col)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "numerai-tools"
3
- version = "0.5.2.dev1"
3
+ version = "0.6.0"
4
4
  description = "A collection of open-source tools to help interact with Numerai, model data, and automate submissions."
5
5
  authors = [
6
6
  {name = "Numerai Engineering",email = "engineering@numer.ai"}
@@ -35,7 +35,7 @@ include = [
35
35
  ]
36
36
 
37
37
  [tool.poetry.dependencies]
38
- pandas = "^2.2.2"
38
+ pandas = ">=2.2.2,<4.0.0"
39
39
  numpy = "^2.0.0"
40
40
  scipy = "^1.13.0"
41
41
  scikit-learn = "^1.5.0"
@@ -44,7 +44,7 @@ scikit-learn = "^1.5.0"
44
44
  pytest = "^8.3.4"
45
45
  mypy = "^1.15.0"
46
46
  ruff = "^0.5.4"
47
- pandas-stubs = "^2.3.0.250703"
47
+ pandas-stubs = ">=2.3.0.250703,<4.0.0"
48
48
  scipy-stubs = "^1.16.1.0"
49
49
 
50
50
  [build-system]