eb-evaluation 0.2.2__tar.gz → 0.2.4__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 (32) hide show
  1. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/LICENSE +28 -28
  2. {eb_evaluation-0.2.2/src/eb_evaluation.egg-info → eb_evaluation-0.2.4}/PKG-INFO +119 -119
  3. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/README.md +85 -85
  4. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/pyproject.toml +91 -91
  5. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/setup.cfg +4 -4
  6. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/__init__.py +60 -82
  7. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/adjustment/__init__.py +25 -25
  8. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/adjustment/_utils.py +166 -168
  9. eb_evaluation-0.2.4/src/eb_evaluation/adjustment/ral.py +290 -0
  10. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/dataframe/__init__.py +32 -40
  11. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/dataframe/entity.py +262 -250
  12. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/dataframe/group.py +214 -216
  13. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/dataframe/hierarchy.py +196 -198
  14. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/dataframe/panel.py +140 -141
  15. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/dataframe/single.py +103 -110
  16. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/model_selection/__init__.py +43 -43
  17. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/model_selection/auto_engine.py +272 -299
  18. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/model_selection/compare.py +427 -419
  19. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/model_selection/cwsl_regressor.py +418 -428
  20. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/model_selection/electric_barometer.py +430 -499
  21. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation/utils/__init__.py +29 -29
  22. eb_evaluation-0.2.4/src/eb_evaluation/utils/validation.py +97 -0
  23. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4/src/eb_evaluation.egg-info}/PKG-INFO +119 -119
  24. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation.egg-info/SOURCES.txt +1 -4
  25. eb_evaluation-0.2.2/src/eb_evaluation/adjustment/readiness_adjustment.py +0 -652
  26. eb_evaluation-0.2.2/src/eb_evaluation/dataframe/cost_ratio.py +0 -224
  27. eb_evaluation-0.2.2/src/eb_evaluation/dataframe/sensitivity.py +0 -192
  28. eb_evaluation-0.2.2/src/eb_evaluation/dataframe/tolerance.py +0 -674
  29. eb_evaluation-0.2.2/src/eb_evaluation/utils/validation.py +0 -100
  30. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation.egg-info/dependency_links.txt +0 -0
  31. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation.egg-info/requires.txt +0 -0
  32. {eb_evaluation-0.2.2 → eb_evaluation-0.2.4}/src/eb_evaluation.egg-info/top_level.txt +0 -0
@@ -1,28 +1,28 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2025, Kyle Corrie
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
10
-
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
14
-
15
- 3. Neither the name of the copyright holder nor the names of its
16
- contributors may be used to endorse or promote products derived from
17
- this software without specific prior written permission.
18
-
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, Kyle Corrie
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,119 +1,119 @@
1
- Metadata-Version: 2.4
2
- Name: eb-evaluation
3
- Version: 0.2.2
4
- Summary: Electric Barometer: DataFrame-based evaluation utilities for CWSL and related metrics.
5
- Author-email: "Kyle Corrie (Economistician)" <kcorrie@economistician.com>
6
- License-Expression: BSD-3-Clause
7
- Project-URL: Homepage, https://github.com/Economistician/eb-evaluation
8
- Project-URL: Repository, https://github.com/Economistician/eb-evaluation
9
- Project-URL: Issues, https://github.com/Economistician/eb-evaluation/issues
10
- Project-URL: Documentation, https://github.com/Economistician/eb-docs
11
- Keywords: electric-barometer,forecast-evaluation,asymmetric-loss,readiness,forecasting,pandas
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Programming Language :: Python :: 3.13
18
- Classifier: Operating System :: OS Independent
19
- Requires-Python: >=3.10
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
- Requires-Dist: numpy>=1.24
23
- Requires-Dist: pandas>=2.0
24
- Requires-Dist: eb-metrics<0.3,>=0.2
25
- Requires-Dist: eb-adapters<0.3,>=0.2
26
- Provides-Extra: test
27
- Requires-Dist: pytest>=8.0; extra == "test"
28
- Requires-Dist: scikit-learn>=1.3; extra == "test"
29
- Provides-Extra: dev
30
- Requires-Dist: pytest>=8.0; extra == "dev"
31
- Requires-Dist: pytest-cov>=5.0; extra == "dev"
32
- Dynamic: license-file
33
-
34
- # Electric Barometer · Evaluation (`eb-evaluation`)
35
-
36
- [![CI](https://github.com/Economistician/eb-evaluation/actions/workflows/ci.yml/badge.svg)](https://github.com/Economistician/eb-evaluation/actions/workflows/ci.yml)
37
- ![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)
38
- ![Python Versions](https://img.shields.io/pypi/pyversions/eb-evaluation)
39
- ![PyPI](https://img.shields.io/pypi/v/eb-evaluation)
40
-
41
- Evaluation and model selection utilities for applying Electric Barometer metrics across entities, groups, and operational contexts.
42
-
43
- ---
44
-
45
- ## Overview
46
-
47
- `eb-evaluation` provides the evaluation and model selection layer of the Electric Barometer ecosystem. It applies metric primitives to forecasts and observations across entities, groups, and hierarchical structures, enabling consistent assessment of forecasting performance in operational settings.
48
-
49
- The package focuses on DataFrame-first evaluation workflows, including tolerance-based scoring, cost-sensitive comparison, and readiness-oriented adjustment logic. It does not define feature construction or model interfaces; instead, it consumes standardized inputs from upstream layers and produces evaluation outputs that can be used for model selection, reporting, and decision support.
50
-
51
- ---
52
-
53
- ## Role in the Electric Barometer Ecosystem
54
-
55
- `eb-evaluation` defines the evaluation and model selection layer used throughout the Electric Barometer ecosystem. It is responsible for applying metric primitives to forecasts and observations across entities, groups, and hierarchies, enabling consistent comparison of forecasting performance in operational contexts.
56
-
57
- This package focuses exclusively on evaluation logic, aggregation semantics, and selection workflows. It does not perform feature construction, model training, or metric definition. Those responsibilities are handled by adjacent layers that generate inputs, adapt model interfaces, or define metric behavior.
58
-
59
- By separating evaluation orchestration from metric semantics and model implementation details, `eb-evaluation` provides a stable, DataFrame-first foundation for decision-aligned model comparison and readiness assessment across heterogeneous forecasting pipelines.
60
-
61
- ---
62
-
63
- ## Installation
64
-
65
- `eb-evaluation` is distributed as a standard Python package.
66
-
67
- ```bash
68
- pip install eb-evaluation
69
- ```
70
-
71
- The package supports Python 3.10 and later.
72
-
73
- ---
74
-
75
- ## Core Concepts
76
-
77
- - **DataFrame-first evaluation** — Evaluation logic operates directly on tabular forecast and observation data, enabling transparent aggregation, grouping, and comparison across entities and hierarchies.
78
- - **Cost- and tolerance-aware scoring** — Forecast performance is assessed using metrics that reflect asymmetric cost, acceptable deviation thresholds, and operational risk rather than purely symmetric statistical error.
79
- - **Hierarchical and panel semantics** — Evaluation respects entity boundaries, grouping structure, and temporal alignment, ensuring correctness in multi-level forecasting environments.
80
- - **Model comparability** — Forecasts produced by heterogeneous models can be evaluated and compared using a consistent set of metrics and aggregation rules.
81
- - **Readiness-oriented selection** — Model selection emphasizes execution feasibility and operational adequacy, not just aggregate accuracy, supporting decision-aligned forecasting workflows.
82
-
83
- ---
84
-
85
- ## Minimal Example
86
-
87
- The example below shows how forecasts and observations can be evaluated and compared across entities using Electric Barometer metrics in a DataFrame-first workflow.
88
-
89
- ```python
90
- import pandas as pd
91
- from eb_evaluation.dataframe.compare import compare_models
92
-
93
- # Example evaluation data
94
- df = pd.DataFrame({
95
- "entity_id": ["A", "A", "B", "B"],
96
- "date": pd.to_datetime(["2024-01-01", "2024-01-02"] * 2),
97
- "actual": [10, 12, 7, 9],
98
- "model_a": [9, 11, 8, 10],
99
- "model_b": [11, 13, 6, 8],
100
- })
101
-
102
- # Compare models using a common evaluation contract
103
- results = compare_models(
104
- df,
105
- actual_col="actual",
106
- prediction_cols=["model_a", "model_b"],
107
- entity_col="entity_id",
108
- time_col="date",
109
- )
110
-
111
- print(results)
112
- ```
113
-
114
- ---
115
-
116
- ## License
117
-
118
- BSD 3-Clause License.
119
- © 2025 Kyle Corrie.
1
+ Metadata-Version: 2.4
2
+ Name: eb-evaluation
3
+ Version: 0.2.4
4
+ Summary: Electric Barometer: DataFrame-based evaluation utilities for CWSL and related metrics.
5
+ Author-email: "Kyle Corrie (Economistician)" <kcorrie@economistician.com>
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/Economistician/eb-evaluation
8
+ Project-URL: Repository, https://github.com/Economistician/eb-evaluation
9
+ Project-URL: Issues, https://github.com/Economistician/eb-evaluation/issues
10
+ Project-URL: Documentation, https://github.com/Economistician/eb-docs
11
+ Keywords: electric-barometer,forecast-evaluation,asymmetric-loss,readiness,forecasting,pandas
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Operating System :: OS Independent
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: numpy>=1.24
23
+ Requires-Dist: pandas>=2.0
24
+ Requires-Dist: eb-metrics<0.3,>=0.2
25
+ Requires-Dist: eb-adapters<0.3,>=0.2
26
+ Provides-Extra: test
27
+ Requires-Dist: pytest>=8.0; extra == "test"
28
+ Requires-Dist: scikit-learn>=1.3; extra == "test"
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=8.0; extra == "dev"
31
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # Electric Barometer · Evaluation (`eb-evaluation`)
35
+
36
+ [![CI](https://github.com/Economistician/eb-evaluation/actions/workflows/ci.yml/badge.svg)](https://github.com/Economistician/eb-evaluation/actions/workflows/ci.yml)
37
+ ![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)
38
+ ![Python Versions](https://img.shields.io/pypi/pyversions/eb-evaluation)
39
+ ![PyPI](https://img.shields.io/pypi/v/eb-evaluation)
40
+
41
+ Evaluation and model selection utilities for applying Electric Barometer metrics across entities, groups, and operational contexts.
42
+
43
+ ---
44
+
45
+ ## Overview
46
+
47
+ `eb-evaluation` provides the evaluation and model selection layer of the Electric Barometer ecosystem. It applies metric primitives to forecasts and observations across entities, groups, and hierarchical structures, enabling consistent assessment of forecasting performance in operational settings.
48
+
49
+ The package focuses on DataFrame-first evaluation workflows, including cost-sensitive comparison, tolerance-aware scoring given explicit thresholds, and readiness-oriented adjustment logic. It does not define feature construction or model interfaces; instead, it consumes standardized inputs from upstream layers and produces evaluation outputs that can be used for model selection, reporting, and decision support.
50
+
51
+ ---
52
+
53
+ ## Role in the Electric Barometer Ecosystem
54
+
55
+ `eb-evaluation` defines the evaluation and model selection layer used throughout the Electric Barometer ecosystem. It is responsible for applying metric primitives to forecasts and observations across entities, groups, and hierarchies, enabling consistent comparison of forecasting performance in operational contexts.
56
+
57
+ This package focuses exclusively on evaluation logic, aggregation semantics, and selection workflows. It does not perform feature construction, model training, or metric definition. Those responsibilities are handled by adjacent layers that generate inputs, adapt model interfaces, or define metric behavior.
58
+
59
+ By separating evaluation orchestration from metric semantics and model implementation details, `eb-evaluation` provides a stable, DataFrame-first foundation for decision-aligned model comparison and readiness assessment across heterogeneous forecasting pipelines.
60
+
61
+ ---
62
+
63
+ ## Installation
64
+
65
+ `eb-evaluation` is distributed as a standard Python package.
66
+
67
+ ```bash
68
+ pip install eb-evaluation
69
+ ```
70
+
71
+ The package supports Python 3.10 and later.
72
+
73
+ ---
74
+
75
+ ## Core Concepts
76
+
77
+ - **DataFrame-first evaluation** — Evaluation logic operates directly on tabular forecast and observation data, enabling transparent aggregation, grouping, and comparison across entities and hierarchies.
78
+ - **Cost- and tolerance-aware scoring** — Forecast performance is assessed using metrics that reflect asymmetric cost and explicitly supplied deviation thresholds, rather than purely symmetric statistical error.
79
+ - **Hierarchical and panel semantics** — Evaluation respects entity boundaries, grouping structure, and temporal alignment, ensuring correctness in multi-level forecasting environments.
80
+ - **Model comparability** — Forecasts produced by heterogeneous models can be evaluated and compared using a consistent set of metrics and aggregation rules.
81
+ - **Readiness-oriented selection** — Model selection emphasizes execution feasibility and operational adequacy as reflected in evaluation metrics, not just aggregate accuracy, supporting decision-aligned forecasting workflows.
82
+
83
+ ---
84
+
85
+ ## Minimal Example
86
+
87
+ The example below shows how forecast accuracy can be evaluated across entities
88
+ using Electric Barometer metrics in a DataFrame-first workflow.
89
+
90
+ ```python
91
+ import pandas as pd
92
+ from eb_evaluation.dataframe import compute_cwsl_df
93
+
94
+ # Example evaluation data
95
+ df = pd.DataFrame({
96
+ "entity_id": ["A", "A", "B", "B"],
97
+ "date": pd.to_datetime(["2024-01-01", "2024-01-02"] * 2),
98
+ "actual": [10, 12, 7, 9],
99
+ "prediction": [9, 11, 8, 10],
100
+ })
101
+
102
+ # Compute Cost-Weighted Service Loss (CWSL)
103
+ results = compute_cwsl_df(
104
+ df,
105
+ actual_col="actual",
106
+ prediction_col="prediction",
107
+ entity_col="entity_id",
108
+ time_col="date",
109
+ )
110
+
111
+ print(results)
112
+ ```
113
+
114
+ ---
115
+
116
+ ## License
117
+
118
+ BSD 3-Clause License.
119
+ © 2025 Kyle Corrie.
@@ -1,86 +1,86 @@
1
- # Electric Barometer · Evaluation (`eb-evaluation`)
2
-
3
- [![CI](https://github.com/Economistician/eb-evaluation/actions/workflows/ci.yml/badge.svg)](https://github.com/Economistician/eb-evaluation/actions/workflows/ci.yml)
4
- ![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)
5
- ![Python Versions](https://img.shields.io/pypi/pyversions/eb-evaluation)
6
- ![PyPI](https://img.shields.io/pypi/v/eb-evaluation)
7
-
8
- Evaluation and model selection utilities for applying Electric Barometer metrics across entities, groups, and operational contexts.
9
-
10
- ---
11
-
12
- ## Overview
13
-
14
- `eb-evaluation` provides the evaluation and model selection layer of the Electric Barometer ecosystem. It applies metric primitives to forecasts and observations across entities, groups, and hierarchical structures, enabling consistent assessment of forecasting performance in operational settings.
15
-
16
- The package focuses on DataFrame-first evaluation workflows, including tolerance-based scoring, cost-sensitive comparison, and readiness-oriented adjustment logic. It does not define feature construction or model interfaces; instead, it consumes standardized inputs from upstream layers and produces evaluation outputs that can be used for model selection, reporting, and decision support.
17
-
18
- ---
19
-
20
- ## Role in the Electric Barometer Ecosystem
21
-
22
- `eb-evaluation` defines the evaluation and model selection layer used throughout the Electric Barometer ecosystem. It is responsible for applying metric primitives to forecasts and observations across entities, groups, and hierarchies, enabling consistent comparison of forecasting performance in operational contexts.
23
-
24
- This package focuses exclusively on evaluation logic, aggregation semantics, and selection workflows. It does not perform feature construction, model training, or metric definition. Those responsibilities are handled by adjacent layers that generate inputs, adapt model interfaces, or define metric behavior.
25
-
26
- By separating evaluation orchestration from metric semantics and model implementation details, `eb-evaluation` provides a stable, DataFrame-first foundation for decision-aligned model comparison and readiness assessment across heterogeneous forecasting pipelines.
27
-
28
- ---
29
-
30
- ## Installation
31
-
32
- `eb-evaluation` is distributed as a standard Python package.
33
-
34
- ```bash
35
- pip install eb-evaluation
36
- ```
37
-
38
- The package supports Python 3.10 and later.
39
-
40
- ---
41
-
42
- ## Core Concepts
43
-
44
- - **DataFrame-first evaluation** — Evaluation logic operates directly on tabular forecast and observation data, enabling transparent aggregation, grouping, and comparison across entities and hierarchies.
45
- - **Cost- and tolerance-aware scoring** — Forecast performance is assessed using metrics that reflect asymmetric cost, acceptable deviation thresholds, and operational risk rather than purely symmetric statistical error.
46
- - **Hierarchical and panel semantics** — Evaluation respects entity boundaries, grouping structure, and temporal alignment, ensuring correctness in multi-level forecasting environments.
47
- - **Model comparability** — Forecasts produced by heterogeneous models can be evaluated and compared using a consistent set of metrics and aggregation rules.
48
- - **Readiness-oriented selection** — Model selection emphasizes execution feasibility and operational adequacy, not just aggregate accuracy, supporting decision-aligned forecasting workflows.
49
-
50
- ---
51
-
52
- ## Minimal Example
53
-
54
- The example below shows how forecasts and observations can be evaluated and compared across entities using Electric Barometer metrics in a DataFrame-first workflow.
55
-
56
- ```python
57
- import pandas as pd
58
- from eb_evaluation.dataframe.compare import compare_models
59
-
60
- # Example evaluation data
61
- df = pd.DataFrame({
62
- "entity_id": ["A", "A", "B", "B"],
63
- "date": pd.to_datetime(["2024-01-01", "2024-01-02"] * 2),
64
- "actual": [10, 12, 7, 9],
65
- "model_a": [9, 11, 8, 10],
66
- "model_b": [11, 13, 6, 8],
67
- })
68
-
69
- # Compare models using a common evaluation contract
70
- results = compare_models(
71
- df,
72
- actual_col="actual",
73
- prediction_cols=["model_a", "model_b"],
74
- entity_col="entity_id",
75
- time_col="date",
76
- )
77
-
78
- print(results)
79
- ```
80
-
81
- ---
82
-
83
- ## License
84
-
85
- BSD 3-Clause License.
1
+ # Electric Barometer · Evaluation (`eb-evaluation`)
2
+
3
+ [![CI](https://github.com/Economistician/eb-evaluation/actions/workflows/ci.yml/badge.svg)](https://github.com/Economistician/eb-evaluation/actions/workflows/ci.yml)
4
+ ![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)
5
+ ![Python Versions](https://img.shields.io/pypi/pyversions/eb-evaluation)
6
+ ![PyPI](https://img.shields.io/pypi/v/eb-evaluation)
7
+
8
+ Evaluation and model selection utilities for applying Electric Barometer metrics across entities, groups, and operational contexts.
9
+
10
+ ---
11
+
12
+ ## Overview
13
+
14
+ `eb-evaluation` provides the evaluation and model selection layer of the Electric Barometer ecosystem. It applies metric primitives to forecasts and observations across entities, groups, and hierarchical structures, enabling consistent assessment of forecasting performance in operational settings.
15
+
16
+ The package focuses on DataFrame-first evaluation workflows, including cost-sensitive comparison, tolerance-aware scoring given explicit thresholds, and readiness-oriented adjustment logic. It does not define feature construction or model interfaces; instead, it consumes standardized inputs from upstream layers and produces evaluation outputs that can be used for model selection, reporting, and decision support.
17
+
18
+ ---
19
+
20
+ ## Role in the Electric Barometer Ecosystem
21
+
22
+ `eb-evaluation` defines the evaluation and model selection layer used throughout the Electric Barometer ecosystem. It is responsible for applying metric primitives to forecasts and observations across entities, groups, and hierarchies, enabling consistent comparison of forecasting performance in operational contexts.
23
+
24
+ This package focuses exclusively on evaluation logic, aggregation semantics, and selection workflows. It does not perform feature construction, model training, or metric definition. Those responsibilities are handled by adjacent layers that generate inputs, adapt model interfaces, or define metric behavior.
25
+
26
+ By separating evaluation orchestration from metric semantics and model implementation details, `eb-evaluation` provides a stable, DataFrame-first foundation for decision-aligned model comparison and readiness assessment across heterogeneous forecasting pipelines.
27
+
28
+ ---
29
+
30
+ ## Installation
31
+
32
+ `eb-evaluation` is distributed as a standard Python package.
33
+
34
+ ```bash
35
+ pip install eb-evaluation
36
+ ```
37
+
38
+ The package supports Python 3.10 and later.
39
+
40
+ ---
41
+
42
+ ## Core Concepts
43
+
44
+ - **DataFrame-first evaluation** — Evaluation logic operates directly on tabular forecast and observation data, enabling transparent aggregation, grouping, and comparison across entities and hierarchies.
45
+ - **Cost- and tolerance-aware scoring** — Forecast performance is assessed using metrics that reflect asymmetric cost and explicitly supplied deviation thresholds, rather than purely symmetric statistical error.
46
+ - **Hierarchical and panel semantics** — Evaluation respects entity boundaries, grouping structure, and temporal alignment, ensuring correctness in multi-level forecasting environments.
47
+ - **Model comparability** — Forecasts produced by heterogeneous models can be evaluated and compared using a consistent set of metrics and aggregation rules.
48
+ - **Readiness-oriented selection** — Model selection emphasizes execution feasibility and operational adequacy as reflected in evaluation metrics, not just aggregate accuracy, supporting decision-aligned forecasting workflows.
49
+
50
+ ---
51
+
52
+ ## Minimal Example
53
+
54
+ The example below shows how forecast accuracy can be evaluated across entities
55
+ using Electric Barometer metrics in a DataFrame-first workflow.
56
+
57
+ ```python
58
+ import pandas as pd
59
+ from eb_evaluation.dataframe import compute_cwsl_df
60
+
61
+ # Example evaluation data
62
+ df = pd.DataFrame({
63
+ "entity_id": ["A", "A", "B", "B"],
64
+ "date": pd.to_datetime(["2024-01-01", "2024-01-02"] * 2),
65
+ "actual": [10, 12, 7, 9],
66
+ "prediction": [9, 11, 8, 10],
67
+ })
68
+
69
+ # Compute Cost-Weighted Service Loss (CWSL)
70
+ results = compute_cwsl_df(
71
+ df,
72
+ actual_col="actual",
73
+ prediction_col="prediction",
74
+ entity_col="entity_id",
75
+ time_col="date",
76
+ )
77
+
78
+ print(results)
79
+ ```
80
+
81
+ ---
82
+
83
+ ## License
84
+
85
+ BSD 3-Clause License.
86
86
  © 2025 Kyle Corrie.