numerai-tools 0.5.0.dev11__tar.gz → 0.5.0.dev13__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.3
2
2
  Name: numerai-tools
3
- Version: 0.5.0.dev11
3
+ Version: 0.5.0.dev13
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
  Author: Numerai Engineering
@@ -9,7 +9,6 @@ from numerai_tools.scoring import (
9
9
  from numerai_tools.submissions import (
10
10
  validate_submission_signals,
11
11
  clean_submission,
12
- remap_ids,
13
12
  )
14
13
 
15
14
  import pandas as pd
@@ -121,7 +120,6 @@ def calculate_max_churn_and_turnover(
121
120
  src_signal_col=curr_signal_col,
122
121
  rank_and_fill=True,
123
122
  )
124
- print("curr_sub", curr_sub)
125
123
  churn_stats = []
126
124
  turnover_stats = []
127
125
  neutralized_weights = generate_neutralized_weights(
@@ -159,7 +157,6 @@ def calculate_max_churn_and_turnover(
159
157
  prev_sample_weight,
160
158
  center_and_normalize=True,
161
159
  )[prev_sub.name]
162
- print("prev_sub", prev_sub)
163
160
  try:
164
161
  churn_val = abs(churn(curr_sub, prev_sub))
165
162
  except AssertionError as e:
@@ -88,7 +88,6 @@ def validate_headers_signals(
88
88
  assert (
89
89
  date_col_name is not None
90
90
  ), "invalid_submission_headers: submission must contain a date column"
91
- print(submission)
92
91
  ticker_col, signal_col = _validate_headers(
93
92
  submission,
94
93
  SIGNALS_ALLOWED_ID_COLS,
@@ -116,14 +115,18 @@ def validate_values(submission: pd.DataFrame, prediction_col: str) -> None:
116
115
  submission -- pandas DataFrame of the submission
117
116
  prediction_col -- the string name of the prediction column returned by validate_headers
118
117
  """
118
+ preds = submission[prediction_col]
119
119
  assert (
120
- submission[prediction_col].isna().sum() == 0
120
+ preds.isna().sum() == 0
121
121
  ), "invalid_submission_values: submission must not contain NaNs"
122
122
  assert (
123
- submission[prediction_col].between(0, 1).all()
123
+ preds.between(0, 1).all()
124
+ or (np.isclose(preds.min(), 0).all() and preds.le(1).all())
125
+ or (preds.ge(0).all() and np.isclose(preds.max(), 1).all())
126
+ or (np.isclose(preds.min(), 0).all() and np.isclose(preds.max(), 1).all())
124
127
  ), "invalid_submission_values: values must be between 0 and 1 exclusive"
125
128
  assert not np.isclose(
126
- 0, submission[prediction_col].std()
129
+ 0, preds.std()
127
130
  ), "invalid_submission_values: submission must have non-zero standard deviation"
128
131
 
129
132
 
@@ -230,7 +233,6 @@ def validate_submission_signals(
230
233
  "Please remove the data_type column from your Signals submission."
231
234
  )
232
235
  submission.drop(columns=["data_type"], errors="ignore", inplace=True)
233
- print(submission)
234
236
  ticker_col, signal_col, date_col = validate_headers_signals(
235
237
  submission, assert_date_col
236
238
  )
@@ -322,10 +324,6 @@ def clean_submission(
322
324
  pd.Series - the cleaned, properly indexed submission
323
325
  """
324
326
  assert len(universe) > 0, "universe must not be empty"
325
- if isinstance(universe, pd.DataFrame):
326
- assert universe.isna().sum().sum() == 0, "universe must not contain NaNs"
327
- else:
328
- assert universe.isna().sum() == 0, "universe must not contain NaNs"
329
327
  assert len(submission) > 0, "predictions must not be empty"
330
328
 
331
329
  if dst_id_col is None:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "numerai-tools"
3
- version = "0.5.0.dev11"
3
+ version = "0.5.0.dev13"
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"}