medpipe 0.3.1__tar.gz → 0.4.0.dev2__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.
Files changed (55) hide show
  1. {medpipe-0.3.1 → medpipe-0.4.0.dev2}/LICENSE +1 -1
  2. {medpipe-0.3.1 → medpipe-0.4.0.dev2}/PKG-INFO +25 -16
  3. medpipe-0.4.0.dev2/pyproject.toml +93 -0
  4. medpipe-0.4.0.dev2/src/medpipe/__init__.py +41 -0
  5. medpipe-0.4.0.dev2/src/medpipe/data/__init__.py +26 -0
  6. medpipe-0.4.0.dev2/src/medpipe/data/registry.py +19 -0
  7. {medpipe-0.3.1 → medpipe-0.4.0.dev2}/src/medpipe/data/utils.py +63 -46
  8. medpipe-0.4.0.dev2/src/medpipe/metrics/__init__.py +31 -0
  9. medpipe-0.4.0.dev2/src/medpipe/metrics/core.py +650 -0
  10. medpipe-0.4.0.dev2/src/medpipe/metrics/registry.py +136 -0
  11. medpipe-0.4.0.dev2/src/medpipe/models/__init__.py +15 -0
  12. medpipe-0.4.0.dev2/src/medpipe/models/registry.py +25 -0
  13. medpipe-0.4.0.dev2/src/medpipe/pipeline/__init__.py +29 -0
  14. medpipe-0.4.0.dev2/src/medpipe/pipeline/estimator.py +98 -0
  15. medpipe-0.4.0.dev2/src/medpipe/pipeline/evaluator.py +902 -0
  16. medpipe-0.4.0.dev2/src/medpipe/pipeline/orchestrator.py +733 -0
  17. medpipe-0.4.0.dev2/src/medpipe/pipeline/pipeline.py +1252 -0
  18. medpipe-0.4.0.dev2/src/medpipe/pipeline/runner.py +826 -0
  19. medpipe-0.4.0.dev2/src/medpipe/utils/__init__.py +41 -0
  20. medpipe-0.4.0.dev2/src/medpipe/utils/config.py +1703 -0
  21. medpipe-0.4.0.dev2/src/medpipe/utils/io.py +190 -0
  22. medpipe-0.4.0.dev2/src/medpipe/utils/logger.py +196 -0
  23. medpipe-0.4.0.dev2/src/medpipe/utils/registry.py +104 -0
  24. medpipe-0.4.0.dev2/src/medpipe/utils/reproducibility.py +303 -0
  25. medpipe-0.3.1/src/medpipe/utils/exceptions.py → medpipe-0.4.0.dev2/src/medpipe/utils/validation.py +6 -82
  26. medpipe-0.4.0.dev2/src/medpipe/visualisation/__init__.py +27 -0
  27. medpipe-0.4.0.dev2/src/medpipe/visualisation/displayer.py +2432 -0
  28. medpipe-0.4.0.dev2/src/medpipe/visualisation/plots.py +1332 -0
  29. medpipe-0.4.0.dev2/src/medpipe/visualisation/themes.py +134 -0
  30. {medpipe-0.3.1 → medpipe-0.4.0.dev2}/src/medpipe.egg-info/PKG-INFO +25 -16
  31. {medpipe-0.3.1 → medpipe-0.4.0.dev2}/src/medpipe.egg-info/SOURCES.txt +15 -8
  32. medpipe-0.4.0.dev2/src/medpipe.egg-info/requires.txt +17 -0
  33. medpipe-0.3.1/pyproject.toml +0 -39
  34. medpipe-0.3.1/requirements.txt +0 -14
  35. medpipe-0.3.1/src/medpipe/__init__.py +0 -46
  36. medpipe-0.3.1/src/medpipe/_types.py +0 -39
  37. medpipe-0.3.1/src/medpipe/data/__init__.py +0 -9
  38. medpipe-0.3.1/src/medpipe/data/transformers.py +0 -87
  39. medpipe-0.3.1/src/medpipe/metrics/__init__.py +0 -16
  40. medpipe-0.3.1/src/medpipe/metrics/core.py +0 -364
  41. medpipe-0.3.1/src/medpipe/metrics/plots.py +0 -722
  42. medpipe-0.3.1/src/medpipe/models/__init__.py +0 -9
  43. medpipe-0.3.1/src/medpipe/models/core.py +0 -157
  44. medpipe-0.3.1/src/medpipe/pipeline/__init__.py +0 -8
  45. medpipe-0.3.1/src/medpipe/pipeline/pipeline.py +0 -1519
  46. medpipe-0.3.1/src/medpipe/py.typed +0 -0
  47. medpipe-0.3.1/src/medpipe/utils/__init__.py +0 -13
  48. medpipe-0.3.1/src/medpipe/utils/config.py +0 -542
  49. medpipe-0.3.1/src/medpipe/utils/io.py +0 -126
  50. medpipe-0.3.1/src/medpipe/utils/logger.py +0 -156
  51. medpipe-0.3.1/src/medpipe.egg-info/requires.txt +0 -14
  52. {medpipe-0.3.1 → medpipe-0.4.0.dev2}/README.md +0 -0
  53. {medpipe-0.3.1 → medpipe-0.4.0.dev2}/setup.cfg +0 -0
  54. {medpipe-0.3.1 → medpipe-0.4.0.dev2}/src/medpipe.egg-info/dependency_links.txt +0 -0
  55. {medpipe-0.3.1 → medpipe-0.4.0.dev2}/src/medpipe.egg-info/top_level.txt +0 -0
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2026 Surgical Recovery and Safety Lab & Mathias Roesler
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,33 +1,42 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: medpipe
3
- Version: 0.3.1
4
- Summary: A package for clinical AI pipeline development
3
+ Version: 0.4.0.dev2
4
+ Summary: Clinical AI pipeline developement following TRIPOD+AI guidelines
5
5
  Author-email: Mathias Roesler <mathias.roesler@auckland.co.nz>
6
6
  License-Expression: Apache-2.0
7
- Project-URL: Changelog, https://github.com/https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/blob/main/CHANGELOG.md
7
+ Project-URL: Changelog, https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/blob/main/CHANGELOG.md
8
8
  Project-URL: Homepage, https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe
9
+ Project-URL: Repository, https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe.git
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Healthcare Industry
12
+ Classifier: Intended Audience :: Science/Research
9
13
  Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3
10
15
  Classifier: Programming Language :: Python :: 3 :: Only
11
16
  Classifier: Programming Language :: Python :: 3.12
12
17
  Classifier: Programming Language :: Python :: 3.13
13
18
  Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
14
21
  Requires-Python: >=3.12
15
22
  Description-Content-Type: text/markdown
16
23
  License-File: LICENSE
17
- Requires-Dist: imbalanced_learn>=0.14.1
18
- Requires-Dist: imblearn==0.0
19
- Requires-Dist: matplotlib>=3.10.8
20
- Requires-Dist: numpy>=2.4.2
21
- Requires-Dist: pandas>=2.3.3
22
- Requires-Dist: pytest>=9.0.1
23
- Requires-Dist: pytest-mock>=3.15.1
24
- Requires-Dist: scikit_learn==1.8.0
25
- Requires-Dist: scipy>=1.17.0
26
- Requires-Dist: pyarrow>=23.0.1
27
- Requires-Dist: pydantic>=2.13.4
28
- Requires-Dist: ml_insights>=1.1.0
24
+ Requires-Dist: matplotlib>=3.10.0
29
25
  Requires-Dist: ngboost>=0.5.10
30
- Requires-Dist: pytest-mock>=3.15.1
26
+ Requires-Dist: numpy>=2.0.0
27
+ Requires-Dist: ordboost>=0.3.1
28
+ Requires-Dist: pandas>=2.2.0
29
+ Requires-Dist: pyarrow>=15.0.0
30
+ Requires-Dist: pydantic>=2.0.0
31
+ Requires-Dist: scikit-learn>=1.8.0
32
+ Requires-Dist: scipy>=1.12.0
33
+ Requires-Dist: scores>=2.6.0
34
+ Requires-Dist: splinecalib>=0.0.13
35
+ Provides-Extra: dev
36
+ Requires-Dist: openpyxl>=3.1.0; extra == "dev"
37
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
38
+ Requires-Dist: pytest-mock>=3.12.0; extra == "dev"
39
+ Requires-Dist: ruff>=0.16.7; extra == "dev"
31
40
  Dynamic: license-file
32
41
 
33
42
  # medpipe
@@ -0,0 +1,93 @@
1
+ [project]
2
+ name = "medpipe"
3
+ description = "Clinical AI pipeline developement following TRIPOD+AI guidelines"
4
+ readme = "README.md"
5
+ requires-python = ">=3.12"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICEN[CS]E*"]
8
+ authors = [
9
+ { name = "Mathias Roesler", email = "mathias.roesler@auckland.co.nz" },
10
+ ]
11
+ classifiers = [
12
+ "Development Status :: 4 - Beta",
13
+ "Intended Audience :: Healthcare Industry",
14
+ "Intended Audience :: Science/Research",
15
+ "Operating System :: POSIX :: Linux",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3 :: Only",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Programming Language :: Python :: 3.14",
21
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
22
+ "Topic :: Scientific/Engineering :: Medical Science Apps.",
23
+ ]
24
+ dynamic = ["version"]
25
+
26
+ # Core runtime dependencies
27
+ dependencies = [
28
+ "matplotlib>=3.10.0",
29
+ "ngboost>=0.5.10",
30
+ "numpy>=2.0.0",
31
+ "ordboost>=0.3.1",
32
+ "pandas>=2.2.0",
33
+ "pyarrow>=15.0.0",
34
+ "pydantic>=2.0.0",
35
+ "scikit-learn>=1.8.0",
36
+ "scipy>=1.12.0",
37
+ "scores>=2.6.0",
38
+ "splinecalib>=0.0.13",
39
+ ]
40
+
41
+ [project.urls]
42
+ Changelog = "https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/blob/main/CHANGELOG.md"
43
+ Homepage = "https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe"
44
+ Repository = "https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe.git"
45
+
46
+ # Development and testing dependencies
47
+ [project.optional-dependencies]
48
+ dev = [
49
+ "openpyxl>=3.1.0",
50
+ "pytest>=8.0.0",
51
+ "pytest-mock>=3.12.0",
52
+ "ruff>=0.16.7",
53
+ ]
54
+
55
+ [build-system]
56
+ requires = ["setuptools>=61.0"]
57
+ build-backend = "setuptools.build_meta"
58
+
59
+ [tool.pytest.ini_options]
60
+ addopts = "-ra -q"
61
+ minversion = "8.0"
62
+ testpaths = ["tests"]
63
+ filterwarnings = [
64
+ # pandas' own feather I/O calls pyarrow's deprecated feather.write_feather /
65
+ # read_feather instead of the new pyarrow.ipc API. This is pandas-internal,
66
+ # not something medpipe controls, and will resolve itself once pandas
67
+ # updates its feather backend.
68
+ "ignore:pyarrow\\.feather\\.(write|read)_feather is deprecated.*:FutureWarning",
69
+ ]
70
+
71
+ [tool.setuptools.packages.find]
72
+ where = ["src"]
73
+
74
+ [tool.setuptools.dynamic]
75
+ version = { attr = "medpipe.__version__" }
76
+
77
+ [tool.ruff]
78
+ target-version = "py312"
79
+ line-length = 88
80
+ src = ["src"]
81
+
82
+ [tool.ruff.lint]
83
+ select = [
84
+ "E", # pycodestyle errors
85
+ "W", # pycodestyle warnings
86
+ "F", # Pyflakes
87
+ "I", # isort
88
+ "UP", # pyupgrade
89
+ "B", # flake8-bugbear
90
+ "C4", # flake8-comprehensions
91
+ "SIM", # flake8-simplify
92
+ "RUF", # Ruff-specific rules
93
+ ]
@@ -0,0 +1,41 @@
1
+ """
2
+ Medpipe: A Python framework for clinical machine learning pipeline
3
+ orchestration.
4
+
5
+ Provides unified high-level interfaces for data preparation, model fitting,
6
+ post-hoc calibration, TRIPOD+AI compliant evaluation, and reproducibility tracking.
7
+ """
8
+
9
+ from medpipe.metrics import MetricRegistry
10
+ from medpipe.models import ModelRegistry
11
+ from medpipe.pipeline import (
12
+ MedpipeClassifier,
13
+ MedpipeClassifierEvaluator,
14
+ MedpipeClassifierRunner,
15
+ MedpipeOrchestrator,
16
+ MedpipeRegressor,
17
+ MedpipeRegressorEvaluator,
18
+ MedpipeRegressorRunner,
19
+ )
20
+ from medpipe.utils import MedpipeClassifierConfig, MedpipeRegressorConfig
21
+
22
+ __version__ = "0.4.0.dev2"
23
+
24
+ __all__ = [ # noqa: RUF022 (grouped by category, not alphabetical)
25
+ # Primary API Entry Points
26
+ "MedpipeClassifier",
27
+ "MedpipeClassifierConfig",
28
+ "MedpipeRegressor",
29
+ "MedpipeRegressorConfig",
30
+ # Sub-Orchestrators (for custom/modular workflows)
31
+ "MedpipeOrchestrator",
32
+ "MedpipeClassifierRunner",
33
+ "MedpipeClassifierEvaluator",
34
+ "MedpipeRegressorRunner",
35
+ "MedpipeRegressorEvaluator",
36
+ # Component Registries (for custom models & metrics)
37
+ "ModelRegistry",
38
+ "MetricRegistry",
39
+ # Package Metadata
40
+ "__version__",
41
+ ]
@@ -0,0 +1,26 @@
1
+ """
2
+ medpipe.data
3
+ ------------
4
+ Data processing, label extraction, dataset splitting, and transformation utilities.
5
+
6
+ Provides functions for label manipulation, train/test/recalibration splitting,
7
+ subgroup mask resolution, and preprocessor registry management.
8
+ """
9
+
10
+ from medpipe.data.registry import PreprocessorRegistry
11
+ from medpipe.data.utils import (
12
+ extract_labels,
13
+ get_split_idx,
14
+ resolve_subgroup_mask,
15
+ split_data,
16
+ )
17
+
18
+ __all__ = [ # noqa: RUF022 (grouped by category, not alphabetical)
19
+ # Data manipulation & split utilities
20
+ "extract_labels",
21
+ "get_split_idx",
22
+ "split_data",
23
+ "resolve_subgroup_mask",
24
+ # Preprocessor registry
25
+ "PreprocessorRegistry",
26
+ ]
@@ -0,0 +1,19 @@
1
+ from collections.abc import Callable
2
+ from types import ModuleType
3
+ from typing import ClassVar
4
+
5
+ import sklearn.impute
6
+ import sklearn.preprocessing
7
+
8
+ from medpipe.utils.registry import BaseRegistry
9
+
10
+
11
+ class PreprocessorRegistry(BaseRegistry[type[Callable]]):
12
+ """
13
+ Registry for managing and resolving data preprocessing operations.
14
+ """
15
+
16
+ _fallback_modules: ClassVar[list[ModuleType]] = [
17
+ sklearn.preprocessing,
18
+ sklearn.impute,
19
+ ]
@@ -7,22 +7,17 @@ Functions:
7
7
  - get_split_idx: Returns the indices for the data splits.
8
8
  - split_data: Split data into train and test or train and recalibration sets.
9
9
  - extract_labels: Extracts prediction labels from data.
10
- - convert_dtypes: Converts data types to category in a pd.DataFrame.
11
10
  """
12
11
 
13
12
  from __future__ import annotations
14
13
 
15
- from typing import TYPE_CHECKING, Literal, cast
14
+ from typing import Any, Literal, cast
16
15
 
17
16
  import numpy as np
17
+ import numpy.typing as npt
18
18
  import pandas as pd
19
19
  from sklearn.model_selection import train_test_split
20
-
21
- from medpipe._types import Labels
22
- from medpipe.utils.exceptions import array_check, array_dim_check
23
-
24
- if TYPE_CHECKING:
25
- import numpy.typing as npt
20
+ from sklearn.utils import check_array, check_consistent_length
26
21
 
27
22
 
28
23
  def get_split_idx(
@@ -56,7 +51,7 @@ def get_split_idx(
56
51
  If values is not a list or a np.ndarray.
57
52
 
58
53
  """
59
- array_check(idx_list)
54
+ check_array(idx_list, ensure_2d=False)
60
55
 
61
56
  # Standardize groups to numpy
62
57
  if isinstance(column, pd.Series):
@@ -64,7 +59,7 @@ def get_split_idx(
64
59
  elif not isinstance(column, np.ndarray):
65
60
  raise TypeError(f"column should be pd.Series or np.array, got {type(column)}")
66
61
 
67
- array_dim_check(idx_list, column, dim=0) # Ensure dimension match
62
+ check_consistent_length(idx_list, column) # Ensure dimension match
68
63
 
69
64
  # Type checking validation
70
65
  if not isinstance(values, (list, np.ndarray)):
@@ -84,13 +79,14 @@ def get_split_idx(
84
79
 
85
80
  def split_data(
86
81
  features: pd.DataFrame,
87
- labels: Labels,
82
+ labels: npt.NDArray,
88
83
  strategy: Literal["random", "group"],
89
84
  group_column: str | None = None,
90
85
  values: list[str] | list[int] | None = None,
91
86
  test_size: float | None = None,
92
87
  recalibration_size: float | None = None,
93
- ) -> tuple[pd.DataFrame, Labels, pd.DataFrame, Labels]:
88
+ random_state: int | None = None,
89
+ ) -> tuple[pd.DataFrame, npt.NDArray, pd.DataFrame, npt.NDArray]:
94
90
  """
95
91
  Split data into train and test or train and recalibration sets.
96
92
 
@@ -102,7 +98,7 @@ def split_data(
102
98
  ----------
103
99
  features : pd.DataFrame
104
100
  Features to split.
105
- labels : Labels
101
+ labels : npt.NDArray
106
102
  Labels to split.
107
103
  strategy : {"random", "group"}
108
104
  Strategy used to split the data.
@@ -114,12 +110,15 @@ def split_data(
114
110
  Test set size if the strategy is random.
115
111
  recalibration_size : float | None, default: None
116
112
  Recalibration set size if the strategy is random.
113
+ random_state : int | None, default: None
114
+ Seed controlling the shuffling applied before the random split, for
115
+ reproducibility. Ignored when strategy is group.
117
116
 
118
117
  Returns
119
118
  -------
120
119
  X_train, X_test : pd.DataFrame
121
120
  Train and test / recalibration set.
122
- y_train, y_test : Labels
121
+ y_train, y_test : npt.NDArray
123
122
  Train and test / recalibration labels.
124
123
 
125
124
  Raises
@@ -165,7 +164,7 @@ def split_data(
165
164
  )
166
165
 
167
166
  X_train, X_test, y_train, y_test = train_test_split(
168
- features, labels, test_size=size
167
+ features, labels, test_size=size, random_state=random_state
169
168
  )
170
169
 
171
170
  else:
@@ -173,15 +172,15 @@ def split_data(
173
172
 
174
173
  return (
175
174
  cast(pd.DataFrame, X_train),
176
- cast(Labels, y_train),
175
+ cast(npt.NDArray, y_train),
177
176
  cast(pd.DataFrame, X_test),
178
- cast(Labels, y_test),
177
+ cast(npt.NDArray, y_test),
179
178
  )
180
179
 
181
180
 
182
181
  def extract_labels(
183
182
  data: pd.DataFrame, labels: list[str]
184
- ) -> tuple[pd.DataFrame, Labels]:
183
+ ) -> tuple[pd.DataFrame, npt.NDArray]:
185
184
  """
186
185
  Extracts the prediction labels from the training data.
187
186
 
@@ -196,7 +195,7 @@ def extract_labels(
196
195
  -------
197
196
  X : pd.DataFrame
198
197
  DataFrame containing the data.
199
- y : Labels
198
+ y : npt.NDArray
200
199
  Array containing the prediction labels.
201
200
 
202
201
  Raises
@@ -227,43 +226,61 @@ def extract_labels(
227
226
  return X, y
228
227
 
229
228
 
230
- def convert_dtypes(X: pd.DataFrame) -> pd.DataFrame:
229
+ def resolve_subgroup_mask(
230
+ df: pd.DataFrame,
231
+ column: str,
232
+ group: Any,
233
+ ) -> pd.Series:
231
234
  """
232
- Convert data types to avoid errors when calling other
233
- functions.
235
+ Generate a boolean mask for a dataset matching a stratum group definition.
234
236
 
235
- Object categories are converted to categoricals. Data is
236
- checked to see if it can be converted to numeric before
237
- converting to categorical.
238
- Timedeltas are converted to days.
237
+ Ranges are inclusive so [18, 50] will include 18 and 50 in the range.
239
238
 
240
239
  Parameters
241
240
  ----------
242
- X : pd.DataFrame
243
- Data to convert.
241
+ df : pd.DataFrame
242
+ Dataset containing the stratum column.
243
+ column : str
244
+ Name of the column to stratify on.
245
+ group : Any
246
+ Group definition. Can be a discrete scalar ('M'), a range tuple (18, 65),
247
+ a pd.Interval.
244
248
 
245
249
  Returns
246
250
  -------
247
- X_converted : pd.DataFrame
248
- Data with converted dtypes.
251
+ pd.Series
252
+ Boolean mask of shape (n_samples,) matching the group criteria.
249
253
 
250
254
  Raises
251
255
  ------
252
- TypeError
253
- If X is not a pd.DataFrame.
256
+ KeyError
257
+ If `column` is not present in `df`.
258
+ ValueError
259
+ If `group` is a tuple or list that does not have exactly 2 elements.
254
260
 
255
261
  """
256
- if not isinstance(X, pd.DataFrame):
257
- raise TypeError(f"Input X should be a pd.DataFrame, but got {type(X)}")
258
- obj_cols = X.select_dtypes(include=["object"]).columns
259
- timedelta_cols = X.select_dtypes(include=["timedelta64"]).columns
260
- for col in obj_cols:
261
- try:
262
- X[col] = pd.to_numeric(X[col])
263
- except ValueError:
264
- X[col] = X[col].astype("category")
265
-
266
- for col in timedelta_cols:
267
- X[col] = X[col].dt.days # Convert timedelta to days
268
-
269
- return X
262
+ if column not in df.columns:
263
+ raise KeyError(f"Stratum column '{column}' not found in DataFrame.")
264
+
265
+ col_data = df[column]
266
+
267
+ # Column is already a Pandas Categorical with pd.Interval values
268
+ if isinstance(group, pd.Interval):
269
+ return col_data == group
270
+
271
+ # Group passed as a tuple/list of bounds: (min, max)
272
+ elif isinstance(group, (tuple, list)) and len(group) == 2:
273
+ lower, upper = group[0], group[1]
274
+ return (col_data >= lower) & (col_data <= upper)
275
+
276
+ # A tuple/list of any other length is not a valid range definition, and
277
+ # would otherwise silently fall through to a positional/length-mismatched
278
+ # equality comparison below.
279
+ elif isinstance(group, (tuple, list)):
280
+ raise ValueError(
281
+ "Range group definitions must have exactly 2 elements (min, max), "
282
+ f"but got {len(group)}: {group!r}"
283
+ )
284
+
285
+ # Standard discrete scalar equality (e.g. string, int, float)
286
+ return col_data == group
@@ -0,0 +1,31 @@
1
+ """
2
+ medpipe.metrics
3
+ ---------------
4
+ Metrics, scoring registries, and plotting utilities for the medpipe package.
5
+
6
+ Provides core metric computation functions, bootstrap confidence interval
7
+ estimation, cross-validation scorer building, and metric registries.
8
+ """
9
+
10
+ from medpipe.metrics.core import (
11
+ PredictionBundle,
12
+ bootstrap_confidence_intervals,
13
+ build_scorers,
14
+ compute_metrics,
15
+ crps_score,
16
+ ici_score,
17
+ )
18
+ from medpipe.metrics.registry import MetricRegistry, MetricSpec
19
+
20
+ __all__ = [ # noqa: RUF022 (grouped by category, not alphabetical)
21
+ # Core metric functions
22
+ "compute_metrics",
23
+ "build_scorers",
24
+ "bootstrap_confidence_intervals",
25
+ "ici_score",
26
+ "crps_score",
27
+ "PredictionBundle",
28
+ # Metric registry and specifications
29
+ "MetricRegistry",
30
+ "MetricSpec",
31
+ ]