numerai-tools 0.5.0.dev12__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.dev12
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
@@ -115,14 +115,18 @@ def validate_values(submission: pd.DataFrame, prediction_col: str) -> None:
115
115
  submission -- pandas DataFrame of the submission
116
116
  prediction_col -- the string name of the prediction column returned by validate_headers
117
117
  """
118
+ preds = submission[prediction_col]
118
119
  assert (
119
- submission[prediction_col].isna().sum() == 0
120
+ preds.isna().sum() == 0
120
121
  ), "invalid_submission_values: submission must not contain NaNs"
121
122
  assert (
122
- 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())
123
127
  ), "invalid_submission_values: values must be between 0 and 1 exclusive"
124
128
  assert not np.isclose(
125
- 0, submission[prediction_col].std()
129
+ 0, preds.std()
126
130
  ), "invalid_submission_values: submission must have non-zero standard deviation"
127
131
 
128
132
 
@@ -320,10 +324,6 @@ def clean_submission(
320
324
  pd.Series - the cleaned, properly indexed submission
321
325
  """
322
326
  assert len(universe) > 0, "universe must not be empty"
323
- if isinstance(universe, pd.DataFrame):
324
- assert universe.isna().sum().sum() == 0, "universe must not contain NaNs"
325
- else:
326
- assert universe.isna().sum() == 0, "universe must not contain NaNs"
327
327
  assert len(submission) > 0, "predictions must not be empty"
328
328
 
329
329
  if dst_id_col is None:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "numerai-tools"
3
- version = "0.5.0.dev12"
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"}