Skip to main content

Electric Barometer · Features (eb-features)

CI License: BSD-3-Clause Python Versions PyPI

Feature engineering primitives for panel-based forecasting systems, designed to integrate seamlessly with the Electric Barometer ecosystem.


Overview

eb-features builds deterministic, panel-aware forecasting features (lags, rolling aggregates, calendar encodings) with explicit entity and time boundaries. It does not train models or evaluate forecasts.


Installation

eb-features is distributed as a standard Python package.

pip install eb-features

The package supports Python 3.11 and later.


Core Concepts

  • Panel-aware feature construction — Features are constructed with explicit awareness of entity boundaries and temporal ordering, ensuring correctness in multi-entity forecasting settings.
  • Deterministic transformations — Feature generation is designed to be reproducible and free of stochastic behavior, supporting auditability and consistent downstream evaluation.
  • Temporal causality — All features respect time directionality, preventing information leakage from future observations into historical feature sets.
  • Rolling and lag semantics — Common forecasting features such as lags and rolling aggregates are treated as first-class primitives with clear, well-defined behavior.
  • Validation by construction — Feature pipelines include explicit checks and constraints to ensure structural validity before model training or evaluation.

Minimal Example

The example below shows how to construct lagged and rolling features for panel data while preserving entity boundaries and temporal ordering.

import pandas as pd
from eb_features import add_lag_features, add_rolling_features

df = pd.DataFrame({
    "entity_id": ["A", "A", "A", "A", "B", "B", "B", "B"],
    "date": pd.to_datetime(
        ["2024-01-01", "2024-01-02", "2024-01-03", "2024-01-04"] * 2
    ),
    "y": [10, 12, 11, 13, 7, 9, 8, 10],
})
df = df.sort_values(["entity_id", "date"], kind="mergesort")

df, lag_cols = add_lag_features(
    df,
    entity_col="entity_id",
    target_col="y",
    lag_steps=[1, 2],
)

df, roll_cols = add_rolling_features(
    df,
    entity_col="entity_id",
    target_col="y",
    rolling_windows=[3],
    rolling_stats=["mean"],
)

print(lag_cols, roll_cols)
print(df)

License

BSD 3-Clause License. © 2026 Kyle Corrie.

Metadata

Release files for eb-features 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eb-features 0.2.7
File Size Uploaded
eb_features-0.2.7.tar.gz 17.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eb-features 0.2.7
File Interpreter ABI Platform
eb_features-0.2.7-py3-none-any.whl Python 3 none any Details

Total release size: 38.5 kB

Release files / eb_features-0.2.7.tar.gz

Download URL eb_features-0.2.7.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
56f134be18698bc2d9adfb8212ee9cc6b9318a77a0374324f64455e26df58456
BLAKE2b-256 checksum
How to use checksums
17b5c35c87670ca1e4b7ae6018d1421333a2c5c2400a111c182aad660bbd5324
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / eb_features-0.2.7-py3-none-any.whl

Download URL eb_features-0.2.7-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a99c46346aa6282337098bed5014b45810c7f59aa94a2107896f3eff4783131
BLAKE2b-256 checksum
How to use checksums
b8ac5eec4e34e6d27a019980aeea664ed5d72ba484317972e3e5ccff41233d02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.2.7 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page