evalsuite-python 1.0.0__py3-none-any.whl → 1.1.1__py3-none-any.whl

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.
evalsuite/api.py CHANGED
@@ -116,14 +116,37 @@ _DEFAULT_REGRESSION = [
116
116
  _NO_WEIGHTS = {"max_error"}
117
117
 
118
118
 
119
- def _infer_task(y_true: ArrayLike, y_prob: Optional[ArrayLike]) -> str:
119
+ def _column(v: Any) -> Any:
120
+ """``v`` as a 1-D array when it is a single column of shape (n, 1); otherwise unchanged."""
121
+ if v is None or (isinstance(v, (list, tuple)) and not (v and isinstance(v[0], (list, tuple)))):
122
+ return v
123
+ shape = getattr(v, "shape", None)
124
+ if shape is None:
125
+ shape = np.shape(v)
126
+ if len(shape) == 2 and shape[1] == 1:
127
+ return np.asarray(v).reshape(-1)
128
+ return v
129
+
130
+
131
+ def _infer_task(y_true: ArrayLike, y_prob: Optional[ArrayLike], y_pred: Optional[ArrayLike] = None) -> str:
120
132
  if y_prob is not None:
121
133
  return "classification"
122
- return (
123
- "regression"
124
- if target_type(to_numpy(y_true, "y_true", allow_2d=True)) == "continuous"
125
- else "classification"
126
- )
134
+ yt = to_numpy(y_true, "y_true", allow_2d=True)
135
+ if target_type(yt) == "continuous":
136
+ return "regression"
137
+ if y_pred is not None and yt.dtype.kind in "iuf":
138
+ yp = to_numpy(y_pred, "y_pred", allow_2d=True)
139
+ if yp.dtype.kind == "f" and target_type(yp) == "continuous":
140
+ # Integer-valued truth with non-integer predictions: regression, unless the predictions look like
141
+ # probabilities of a 0/1 outcome, which belong in y_prob.
142
+ finite = yp[np.isfinite(yp)]
143
+ if set(np.unique(yt).tolist()) <= {0, 1} and finite.size and finite.min() >= 0 and finite.max() <= 1:
144
+ raise InputValidationError(
145
+ "y_pred holds values between 0 and 1 for a 0/1 outcome; pass probabilities as y_prob=..., "
146
+ "or set task='regression'."
147
+ )
148
+ return "regression"
149
+ return "classification"
127
150
 
128
151
 
129
152
  def evaluate(
@@ -176,7 +199,11 @@ def evaluate(
176
199
  "y_true has 3 or more dimensions, which looks like segmentation masks (images first); use "
177
200
  "evalsuite.segmentation_report(y_true, y_pred) or evalsuite.dice / evalsuite.iou."
178
201
  )
179
- task = task or _infer_task(y_true, y_prob)
202
+ # A single column (n, 1), e.g. a one-column DataFrame or a reshaped array, is a plain vector.
203
+ y_true, y_pred, y_prob, baseline_pred, baseline_prob = (
204
+ _column(v) for v in (y_true, y_pred, y_prob, baseline_pred, baseline_prob)
205
+ )
206
+ task = task or _infer_task(y_true, y_prob, y_pred)
180
207
  if task == "classification":
181
208
  result = _evaluate_classification(
182
209
  y_true, y_pred, y_prob, metrics, average, labels, pos_label, sample_weight, zero_division
evalsuite/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Package version (single source of truth, read by the build backend)."""
2
2
 
3
- __version__ = "1.0.0"
3
+ __version__ = "1.1.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: evalsuite-python
3
- Version: 1.0.0
3
+ Version: 1.1.1
4
4
  Summary: A unified Python framework for machine-learning, clinical, statistical, segmentation, object-detection, uncertainty, and model evaluation.
5
5
  Project-URL: Homepage, https://evalsuite-nine.vercel.app
6
6
  Project-URL: Documentation, https://evalsuite-nine.vercel.app/docs
@@ -97,7 +97,7 @@ Description-Content-Type: text/markdown
97
97
  EvalSuite brings classification, regression, clinical, statistical, segmentation and object-detection
98
98
  evaluation into one consistent, validated, documented framework.
99
99
 
100
- > **Status: stable (1.0.0).** **1.0** makes `evaluate()` report confidence intervals by default and test
100
+ > **Status: stable (1.1.1).** Try it in Colab: [example notebooks](notebooks/README.md). **1.0** makes `evaluate()` report confidence intervals by default and test
101
101
  > against a baseline, and adds an LLM leaderboard harness, framework integrations (scikit-learn, Hugging Face,
102
102
  > Keras, Lightning, MLflow, W&B), monitoring with drift alerts, TRIPOD+AI / model-card report cards, and the same
103
103
  > engine for JavaScript (npm, WebAssembly), C, R and Julia.
@@ -4,7 +4,7 @@ evalsuite/_bench_metrics.py,sha256=GLLa9OhCNmu6IyWkxC0AcNf7p-CTpoOwWUS99C1o2o8,7
4
4
  evalsuite/_evalci.py,sha256=iyFyMZFAoEwKjsXj0qsAxrhLdWRtsW47HP4lO0n0bEQ,10296
5
5
  evalsuite/_lazy.py,sha256=Ddq0uWuiyxtsT0jBtCSITQPvttiQ7znXAbjkMIOVefk,901
6
6
  evalsuite/_native.py,sha256=haMBiKqPDmHGoGbq4Cn8iFmm1Vt-tFYYsyRQ3XLyueE,2351
7
- evalsuite/api.py,sha256=HLJ4d3_aaXbDp47aGAjHC81RcFMkSCOEwdgRk_WTmaA,11744
7
+ evalsuite/api.py,sha256=XaL5eEThZ0TI-C4I6wfNKlNYQ0VSQfJQa72kMbFXo9Q,13225
8
8
  evalsuite/benchmarks.py,sha256=TWXIhdYPbdDPanCOFL1lRCo3ppRYaDF58PB-o3ZZyTA,37846
9
9
  evalsuite/calibration.py,sha256=jhCPOmCFGEkUkcx-hSAIb-JCMq9oF6JZt4uDGvg5NaU,15083
10
10
  evalsuite/cards.py,sha256=LkYy2JI4LxoJbb_Fdr0z768--2JsuBRmaZ9b6NpssnI,18496
@@ -14,7 +14,7 @@ evalsuite/monitor.py,sha256=qW8KGJSm-9boIUQoiylxJRV_yD_jvCGh-rFXNKyPPlI,9006
14
14
  evalsuite/plot.py,sha256=7eOyzoRbg6Aad6OhtIQG3laIioQ8fs2K0YzodjG5rHA,26049
15
15
  evalsuite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  evalsuite/reporting.py,sha256=-LISv9vvEnltT26GtzLjVlxOCcAwmjv4-HyB8_1UF5o,9615
17
- evalsuite/version.py,sha256=GlFInrJOZRLXvhRjHbWc-MhOjoak6v267niGe-XIBkU,98
17
+ evalsuite/version.py,sha256=T5RyRYypebpvPjAvY4JamF9A_4SmRHKCOeISFGTGgT4,98
18
18
  evalsuite/classification/__init__.py,sha256=ErBIXbBGnhfW6v-1Cn5SegiERoyxNlmO1tEKcLM15mA,833
19
19
  evalsuite/classification/_common.py,sha256=3ANV33ix_mnOzvOAG8glyJO-iYVhhTGO0S3YG0ZddB8,4543
20
20
  evalsuite/classification/metrics.py,sha256=cP9TAVVk6Pob2VUuxMfQpOakzVmuMOXzGzqO2oGhED8,40575
@@ -67,9 +67,9 @@ evalsuite/text/structured.py,sha256=x08yYf2rdlmiA_D_dI1L-fc9quHiBPMKgAGQbG3kJr8,
67
67
  evalsuite/vision/__init__.py,sha256=9gpOBTPveM_srE6BM-SgCssdQurya2LPHhoMLGOh2A0,991
68
68
  evalsuite/vision/detection.py,sha256=Cjr-Y5-pV0wiQk1JiHLYvDdKzMlCEvVQarzY7fqGWw4,32010
69
69
  evalsuite/vision/segmentation.py,sha256=tYYsBfEYdPvi94k3dJgp8ODn8X0qKsLW5QAv7KuQMj0,41953
70
- evalsuite_python-1.0.0.dist-info/METADATA,sha256=j6reZFvvPrM1ghpp5EFCBKkYbWd7M64Mam7prSYQw8A,31080
71
- evalsuite_python-1.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
72
- evalsuite_python-1.0.0.dist-info/entry_points.txt,sha256=YYIwisn4L4sQt3ntzbM0_Z4yZE2KCu3GJ6KfWL1kIwc,54
73
- evalsuite_python-1.0.0.dist-info/licenses/LICENSE,sha256=cRRQ6Kk8w2qCqtDSSUJQGy-0rqjmjJG09cZ6iIiMvdc,1095
74
- evalsuite_python-1.0.0.dist-info/licenses/LICENSE-APACHE,sha256=K4pWYv3dt61u1BuIxjOGBxhgRkpsH4X_dzeIbOILXw0,10784
75
- evalsuite_python-1.0.0.dist-info/RECORD,,
70
+ evalsuite_python-1.1.1.dist-info/METADATA,sha256=P3tpnovF6UPtbSDZKi04d5_ougzkluE6bhXYa8w_2-U,31139
71
+ evalsuite_python-1.1.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
72
+ evalsuite_python-1.1.1.dist-info/entry_points.txt,sha256=YYIwisn4L4sQt3ntzbM0_Z4yZE2KCu3GJ6KfWL1kIwc,54
73
+ evalsuite_python-1.1.1.dist-info/licenses/LICENSE,sha256=cRRQ6Kk8w2qCqtDSSUJQGy-0rqjmjJG09cZ6iIiMvdc,1095
74
+ evalsuite_python-1.1.1.dist-info/licenses/LICENSE-APACHE,sha256=K4pWYv3dt61u1BuIxjOGBxhgRkpsH4X_dzeIbOILXw0,10784
75
+ evalsuite_python-1.1.1.dist-info/RECORD,,