eb-features 0.2.0__tar.gz → 0.2.2__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.
- {eb_features-0.2.0 → eb_features-0.2.2}/LICENSE +28 -28
- {eb_features-0.2.0/src/eb_features.egg-info → eb_features-0.2.2}/PKG-INFO +126 -126
- {eb_features-0.2.0 → eb_features-0.2.2}/README.md +93 -93
- {eb_features-0.2.0 → eb_features-0.2.2}/pyproject.toml +81 -81
- {eb_features-0.2.0 → eb_features-0.2.2}/setup.cfg +4 -4
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/__init__.py +19 -19
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/panel/__init__.py +41 -41
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/panel/calendar.py +192 -192
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/panel/config.py +94 -94
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/panel/constants.py +74 -74
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/panel/encoders.py +90 -90
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/panel/engineering.py +303 -303
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/panel/lags.py +94 -94
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/panel/rolling.py +169 -169
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features/panel/validation.py +127 -127
- {eb_features-0.2.0 → eb_features-0.2.2/src/eb_features.egg-info}/PKG-INFO +126 -126
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features.egg-info/SOURCES.txt +0 -0
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features.egg-info/dependency_links.txt +0 -0
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features.egg-info/requires.txt +0 -0
- {eb_features-0.2.0 → eb_features-0.2.2}/src/eb_features.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,126 +1,126 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: eb-features
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: Feature engineering utilities for panel time-series data in the Electric Barometer ecosystem.
|
|
5
|
-
Author-email: "Kyle Corrie (Economistician)" <kcorrie@economistician.com>
|
|
6
|
-
License-Expression: BSD-3-Clause
|
|
7
|
-
Project-URL: Homepage, https://github.com/Economistician/eb-features
|
|
8
|
-
Project-URL: Repository, https://github.com/Economistician/eb-features
|
|
9
|
-
Project-URL: Issues, https://github.com/Economistician/eb-features/issues
|
|
10
|
-
Project-URL: Documentation, https://economistician.github.io/eb-docs/
|
|
11
|
-
Keywords: forecasting,features,feature-engineering,time-series,panel-data,operations-research
|
|
12
|
-
Classifier: Development Status :: 3 - Alpha
|
|
13
|
-
Classifier: Intended Audience :: Science/Research
|
|
14
|
-
Classifier: Intended Audience :: Developers
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
-
Classifier: Operating System :: OS Independent
|
|
22
|
-
Classifier: Topic :: Scientific/Engineering
|
|
23
|
-
Requires-Python: >=3.10
|
|
24
|
-
Description-Content-Type: text/markdown
|
|
25
|
-
License-File: LICENSE
|
|
26
|
-
Requires-Dist: numpy>=1.24
|
|
27
|
-
Requires-Dist: pandas>=2.0
|
|
28
|
-
Provides-Extra: dev
|
|
29
|
-
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
30
|
-
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
31
|
-
Dynamic: license-file
|
|
32
|
-
|
|
33
|
-
# Electric Barometer · Features (`eb-features`)
|
|
34
|
-
|
|
35
|
-
[](https://github.com/Economistician/eb-features/actions/workflows/ci.yml)
|
|
36
|
-

|
|
37
|
-

|
|
38
|
-

|
|
39
|
-
|
|
40
|
-
Feature engineering primitives for panel-based forecasting systems, designed to integrate seamlessly with the Electric Barometer ecosystem.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Overview
|
|
45
|
-
|
|
46
|
-
`eb-features` is a modular feature engineering library for panel-based forecasting systems. It provides reusable, deterministic transformations for constructing time-aware features across entities observed over time.
|
|
47
|
-
|
|
48
|
-
Within the Electric Barometer ecosystem, `eb-features` serves as the upstream feature construction layer, producing standardized inputs for downstream evaluation and metric components. While designed to integrate seamlessly with Electric Barometer, the package remains framework-agnostic and can be used independently in other forecasting workflows.
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Role in the Electric Barometer Ecosystem
|
|
53
|
-
|
|
54
|
-
`eb-features` defines the feature engineering primitives used throughout the Electric Barometer ecosystem. It is responsible for constructing deterministic, panel-aware input features—such as lags, rolling aggregations, and calendar encodings—that serve as the foundational inputs to forecasting and evaluation workflows.
|
|
55
|
-
|
|
56
|
-
This package focuses exclusively on feature construction and validation. It does not perform model training, forecast generation, metric evaluation, or decision logic. Those responsibilities are handled by downstream layers in the ecosystem that consume engineered features for modeling, selection, and operational assessment.
|
|
57
|
-
|
|
58
|
-
By separating feature semantics from modeling and evaluation concerns, `eb-features` provides a stable, reusable foundation that ensures consistency and reproducibility across forecasting pipelines operating on heterogeneous panel data.
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Installation
|
|
63
|
-
|
|
64
|
-
`eb-features` is distributed as a standard Python package.
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
pip install eb-features
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
The package supports Python 3.10 and later.
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Core Concepts
|
|
75
|
-
|
|
76
|
-
- **Panel-aware feature construction** — Features are constructed with explicit awareness of entity boundaries and temporal ordering, ensuring correctness in multi-entity forecasting settings.
|
|
77
|
-
- **Deterministic transformations** — Feature generation is designed to be reproducible and free of stochastic behavior, supporting auditability and consistent downstream evaluation.
|
|
78
|
-
- **Temporal causality** — All features respect time directionality, preventing information leakage from future observations into historical feature sets.
|
|
79
|
-
- **Rolling and lag semantics** — Common forecasting features such as lags and rolling aggregates are treated as first-class primitives with clear, well-defined behavior.
|
|
80
|
-
- **Validation by construction** — Feature pipelines include explicit checks and constraints to ensure structural validity before model training or evaluation.
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Minimal Example
|
|
85
|
-
|
|
86
|
-
The example below shows how to construct lagged and rolling features for panel data while preserving entity boundaries and temporal ordering.
|
|
87
|
-
|
|
88
|
-
```python
|
|
89
|
-
import pandas as pd
|
|
90
|
-
from eb_features.panel.lags import add_lag_features
|
|
91
|
-
from eb_features.panel.rolling import add_rolling_features
|
|
92
|
-
|
|
93
|
-
# Example panel data
|
|
94
|
-
df = pd.DataFrame({
|
|
95
|
-
"entity_id": ["A", "A", "A", "B", "B"],
|
|
96
|
-
"date": pd.date_range("2024-01-01", periods=5, freq="D"),
|
|
97
|
-
"y": [10, 12, 11, 7, 9],
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
# Add lagged features
|
|
101
|
-
df = add_lag_features(
|
|
102
|
-
df,
|
|
103
|
-
value_col="y",
|
|
104
|
-
lags=[1, 2],
|
|
105
|
-
entity_col="entity_id",
|
|
106
|
-
time_col="date",
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
# Add rolling features
|
|
110
|
-
df = add_rolling_features(
|
|
111
|
-
df,
|
|
112
|
-
value_col="y",
|
|
113
|
-
windows=[3],
|
|
114
|
-
entity_col="entity_id",
|
|
115
|
-
time_col="date",
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
print(df)
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## License
|
|
124
|
-
|
|
125
|
-
BSD 3-Clause License.
|
|
126
|
-
© 2025 Kyle Corrie.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: eb-features
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Feature engineering utilities for panel time-series data in the Electric Barometer ecosystem.
|
|
5
|
+
Author-email: "Kyle Corrie (Economistician)" <kcorrie@economistician.com>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/Economistician/eb-features
|
|
8
|
+
Project-URL: Repository, https://github.com/Economistician/eb-features
|
|
9
|
+
Project-URL: Issues, https://github.com/Economistician/eb-features/issues
|
|
10
|
+
Project-URL: Documentation, https://economistician.github.io/eb-docs/
|
|
11
|
+
Keywords: forecasting,features,feature-engineering,time-series,panel-data,operations-research
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: numpy>=1.24
|
|
27
|
+
Requires-Dist: pandas>=2.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# Electric Barometer · Features (`eb-features`)
|
|
34
|
+
|
|
35
|
+
[](https://github.com/Economistician/eb-features/actions/workflows/ci.yml)
|
|
36
|
+

|
|
37
|
+

|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
Feature engineering primitives for panel-based forecasting systems, designed to integrate seamlessly with the Electric Barometer ecosystem.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Overview
|
|
45
|
+
|
|
46
|
+
`eb-features` is a modular feature engineering library for panel-based forecasting systems. It provides reusable, deterministic transformations for constructing time-aware features across entities observed over time.
|
|
47
|
+
|
|
48
|
+
Within the Electric Barometer ecosystem, `eb-features` serves as the upstream feature construction layer, producing standardized inputs for downstream evaluation and metric components. While designed to integrate seamlessly with Electric Barometer, the package remains framework-agnostic and can be used independently in other forecasting workflows.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Role in the Electric Barometer Ecosystem
|
|
53
|
+
|
|
54
|
+
`eb-features` defines the feature engineering primitives used throughout the Electric Barometer ecosystem. It is responsible for constructing deterministic, panel-aware input features—such as lags, rolling aggregations, and calendar encodings—that serve as the foundational inputs to forecasting and evaluation workflows.
|
|
55
|
+
|
|
56
|
+
This package focuses exclusively on feature construction and validation. It does not perform model training, forecast generation, metric evaluation, or decision logic. Those responsibilities are handled by downstream layers in the ecosystem that consume engineered features for modeling, selection, and operational assessment.
|
|
57
|
+
|
|
58
|
+
By separating feature semantics from modeling and evaluation concerns, `eb-features` provides a stable, reusable foundation that ensures consistency and reproducibility across forecasting pipelines operating on heterogeneous panel data.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
`eb-features` is distributed as a standard Python package.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install eb-features
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The package supports Python 3.10 and later.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Core Concepts
|
|
75
|
+
|
|
76
|
+
- **Panel-aware feature construction** — Features are constructed with explicit awareness of entity boundaries and temporal ordering, ensuring correctness in multi-entity forecasting settings.
|
|
77
|
+
- **Deterministic transformations** — Feature generation is designed to be reproducible and free of stochastic behavior, supporting auditability and consistent downstream evaluation.
|
|
78
|
+
- **Temporal causality** — All features respect time directionality, preventing information leakage from future observations into historical feature sets.
|
|
79
|
+
- **Rolling and lag semantics** — Common forecasting features such as lags and rolling aggregates are treated as first-class primitives with clear, well-defined behavior.
|
|
80
|
+
- **Validation by construction** — Feature pipelines include explicit checks and constraints to ensure structural validity before model training or evaluation.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Minimal Example
|
|
85
|
+
|
|
86
|
+
The example below shows how to construct lagged and rolling features for panel data while preserving entity boundaries and temporal ordering.
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import pandas as pd
|
|
90
|
+
from eb_features.panel.lags import add_lag_features
|
|
91
|
+
from eb_features.panel.rolling import add_rolling_features
|
|
92
|
+
|
|
93
|
+
# Example panel data
|
|
94
|
+
df = pd.DataFrame({
|
|
95
|
+
"entity_id": ["A", "A", "A", "B", "B"],
|
|
96
|
+
"date": pd.date_range("2024-01-01", periods=5, freq="D"),
|
|
97
|
+
"y": [10, 12, 11, 7, 9],
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
# Add lagged features
|
|
101
|
+
df = add_lag_features(
|
|
102
|
+
df,
|
|
103
|
+
value_col="y",
|
|
104
|
+
lags=[1, 2],
|
|
105
|
+
entity_col="entity_id",
|
|
106
|
+
time_col="date",
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
# Add rolling features
|
|
110
|
+
df = add_rolling_features(
|
|
111
|
+
df,
|
|
112
|
+
value_col="y",
|
|
113
|
+
windows=[3],
|
|
114
|
+
entity_col="entity_id",
|
|
115
|
+
time_col="date",
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
print(df)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
BSD 3-Clause License.
|
|
126
|
+
© 2025 Kyle Corrie.
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
# Electric Barometer · Features (`eb-features`)
|
|
2
|
-
|
|
3
|
-
[](https://github.com/Economistician/eb-features/actions/workflows/ci.yml)
|
|
4
|
-

|
|
5
|
-

|
|
6
|
-

|
|
7
|
-
|
|
8
|
-
Feature engineering primitives for panel-based forecasting systems, designed to integrate seamlessly with the Electric Barometer ecosystem.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
13
|
-
|
|
14
|
-
`eb-features` is a modular feature engineering library for panel-based forecasting systems. It provides reusable, deterministic transformations for constructing time-aware features across entities observed over time.
|
|
15
|
-
|
|
16
|
-
Within the Electric Barometer ecosystem, `eb-features` serves as the upstream feature construction layer, producing standardized inputs for downstream evaluation and metric components. While designed to integrate seamlessly with Electric Barometer, the package remains framework-agnostic and can be used independently in other forecasting workflows.
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Role in the Electric Barometer Ecosystem
|
|
21
|
-
|
|
22
|
-
`eb-features` defines the feature engineering primitives used throughout the Electric Barometer ecosystem. It is responsible for constructing deterministic, panel-aware input features—such as lags, rolling aggregations, and calendar encodings—that serve as the foundational inputs to forecasting and evaluation workflows.
|
|
23
|
-
|
|
24
|
-
This package focuses exclusively on feature construction and validation. It does not perform model training, forecast generation, metric evaluation, or decision logic. Those responsibilities are handled by downstream layers in the ecosystem that consume engineered features for modeling, selection, and operational assessment.
|
|
25
|
-
|
|
26
|
-
By separating feature semantics from modeling and evaluation concerns, `eb-features` provides a stable, reusable foundation that ensures consistency and reproducibility across forecasting pipelines operating on heterogeneous panel data.
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Installation
|
|
31
|
-
|
|
32
|
-
`eb-features` is distributed as a standard Python package.
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
pip install eb-features
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
The package supports Python 3.10 and later.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Core Concepts
|
|
43
|
-
|
|
44
|
-
- **Panel-aware feature construction** — Features are constructed with explicit awareness of entity boundaries and temporal ordering, ensuring correctness in multi-entity forecasting settings.
|
|
45
|
-
- **Deterministic transformations** — Feature generation is designed to be reproducible and free of stochastic behavior, supporting auditability and consistent downstream evaluation.
|
|
46
|
-
- **Temporal causality** — All features respect time directionality, preventing information leakage from future observations into historical feature sets.
|
|
47
|
-
- **Rolling and lag semantics** — Common forecasting features such as lags and rolling aggregates are treated as first-class primitives with clear, well-defined behavior.
|
|
48
|
-
- **Validation by construction** — Feature pipelines include explicit checks and constraints to ensure structural validity before model training or evaluation.
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Minimal Example
|
|
53
|
-
|
|
54
|
-
The example below shows how to construct lagged and rolling features for panel data while preserving entity boundaries and temporal ordering.
|
|
55
|
-
|
|
56
|
-
```python
|
|
57
|
-
import pandas as pd
|
|
58
|
-
from eb_features.panel.lags import add_lag_features
|
|
59
|
-
from eb_features.panel.rolling import add_rolling_features
|
|
60
|
-
|
|
61
|
-
# Example panel data
|
|
62
|
-
df = pd.DataFrame({
|
|
63
|
-
"entity_id": ["A", "A", "A", "B", "B"],
|
|
64
|
-
"date": pd.date_range("2024-01-01", periods=5, freq="D"),
|
|
65
|
-
"y": [10, 12, 11, 7, 9],
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
# Add lagged features
|
|
69
|
-
df = add_lag_features(
|
|
70
|
-
df,
|
|
71
|
-
value_col="y",
|
|
72
|
-
lags=[1, 2],
|
|
73
|
-
entity_col="entity_id",
|
|
74
|
-
time_col="date",
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
# Add rolling features
|
|
78
|
-
df = add_rolling_features(
|
|
79
|
-
df,
|
|
80
|
-
value_col="y",
|
|
81
|
-
windows=[3],
|
|
82
|
-
entity_col="entity_id",
|
|
83
|
-
time_col="date",
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
print(df)
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## License
|
|
92
|
-
|
|
93
|
-
BSD 3-Clause License.
|
|
1
|
+
# Electric Barometer · Features (`eb-features`)
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Economistician/eb-features/actions/workflows/ci.yml)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
Feature engineering primitives for panel-based forecasting systems, designed to integrate seamlessly with the Electric Barometer ecosystem.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
`eb-features` is a modular feature engineering library for panel-based forecasting systems. It provides reusable, deterministic transformations for constructing time-aware features across entities observed over time.
|
|
15
|
+
|
|
16
|
+
Within the Electric Barometer ecosystem, `eb-features` serves as the upstream feature construction layer, producing standardized inputs for downstream evaluation and metric components. While designed to integrate seamlessly with Electric Barometer, the package remains framework-agnostic and can be used independently in other forecasting workflows.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Role in the Electric Barometer Ecosystem
|
|
21
|
+
|
|
22
|
+
`eb-features` defines the feature engineering primitives used throughout the Electric Barometer ecosystem. It is responsible for constructing deterministic, panel-aware input features—such as lags, rolling aggregations, and calendar encodings—that serve as the foundational inputs to forecasting and evaluation workflows.
|
|
23
|
+
|
|
24
|
+
This package focuses exclusively on feature construction and validation. It does not perform model training, forecast generation, metric evaluation, or decision logic. Those responsibilities are handled by downstream layers in the ecosystem that consume engineered features for modeling, selection, and operational assessment.
|
|
25
|
+
|
|
26
|
+
By separating feature semantics from modeling and evaluation concerns, `eb-features` provides a stable, reusable foundation that ensures consistency and reproducibility across forecasting pipelines operating on heterogeneous panel data.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
`eb-features` is distributed as a standard Python package.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install eb-features
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The package supports Python 3.10 and later.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Core Concepts
|
|
43
|
+
|
|
44
|
+
- **Panel-aware feature construction** — Features are constructed with explicit awareness of entity boundaries and temporal ordering, ensuring correctness in multi-entity forecasting settings.
|
|
45
|
+
- **Deterministic transformations** — Feature generation is designed to be reproducible and free of stochastic behavior, supporting auditability and consistent downstream evaluation.
|
|
46
|
+
- **Temporal causality** — All features respect time directionality, preventing information leakage from future observations into historical feature sets.
|
|
47
|
+
- **Rolling and lag semantics** — Common forecasting features such as lags and rolling aggregates are treated as first-class primitives with clear, well-defined behavior.
|
|
48
|
+
- **Validation by construction** — Feature pipelines include explicit checks and constraints to ensure structural validity before model training or evaluation.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Minimal Example
|
|
53
|
+
|
|
54
|
+
The example below shows how to construct lagged and rolling features for panel data while preserving entity boundaries and temporal ordering.
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import pandas as pd
|
|
58
|
+
from eb_features.panel.lags import add_lag_features
|
|
59
|
+
from eb_features.panel.rolling import add_rolling_features
|
|
60
|
+
|
|
61
|
+
# Example panel data
|
|
62
|
+
df = pd.DataFrame({
|
|
63
|
+
"entity_id": ["A", "A", "A", "B", "B"],
|
|
64
|
+
"date": pd.date_range("2024-01-01", periods=5, freq="D"),
|
|
65
|
+
"y": [10, 12, 11, 7, 9],
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
# Add lagged features
|
|
69
|
+
df = add_lag_features(
|
|
70
|
+
df,
|
|
71
|
+
value_col="y",
|
|
72
|
+
lags=[1, 2],
|
|
73
|
+
entity_col="entity_id",
|
|
74
|
+
time_col="date",
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Add rolling features
|
|
78
|
+
df = add_rolling_features(
|
|
79
|
+
df,
|
|
80
|
+
value_col="y",
|
|
81
|
+
windows=[3],
|
|
82
|
+
entity_col="entity_id",
|
|
83
|
+
time_col="date",
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
print(df)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
BSD 3-Clause License.
|
|
94
94
|
© 2025 Kyle Corrie.
|