Skip to main content

Adapter layer for third-party forecasting libraries in Electric Barometer

Project description

Electric Barometer · Adapters (eb-adapters)

CI License: BSD-3-Clause Python Versions PyPI

Adapter interfaces that normalize forecasting model APIs for consistent evaluation within the Electric Barometer ecosystem.


Overview

eb-adapters provides a thin adapter layer that normalizes the interfaces of heterogeneous forecasting libraries into a consistent, evaluation-ready API. It enables models from different frameworks to be trained, predicted, and evaluated using a common contract, without requiring downstream systems to account for library-specific behaviors.

Within the Electric Barometer ecosystem, eb-adapters serves as the bridge between model implementations and evaluation logic. By isolating framework-specific details behind stable adapter interfaces, the package allows forecasting models to be compared, selected, and assessed consistently across diverse modeling stacks, while remaining usable outside the ecosystem in standalone evaluation workflows.


Role in the Electric Barometer Ecosystem

eb-adapters defines the model interface normalization layer used throughout the Electric Barometer ecosystem. It is responsible for wrapping heterogeneous forecasting libraries behind a consistent training and prediction contract, allowing models from different frameworks to be evaluated in a uniform manner.

This package focuses exclusively on adapting model APIs and handling framework-specific behaviors. It does not perform feature construction, forecast evaluation, metric definition, or decision logic. Those responsibilities are handled by adjacent layers in the ecosystem that generate inputs, apply evaluation logic, or interpret results.

By separating model integration concerns from evaluation and metric semantics, eb-adapters enables fair, reproducible comparison of forecasting approaches across diverse modeling stacks, while keeping downstream systems agnostic to underlying implementation details.


Installation

eb-adapters is distributed as a standard Python package.

pip install eb-adapters

The package supports Python 3.10 and later.


Core Concepts

  • Interface normalization — Forecasting models from different libraries are wrapped behind a common training and prediction contract, enabling uniform downstream evaluation.
  • Thin adaptation layer — Adapters aim to be minimal and non-invasive, preserving native model behavior while standardizing how models are invoked.
  • Framework isolation — Library-specific configuration, defaults, and quirks are contained within adapters, preventing leakage into evaluation or orchestration layers.
  • Explicit lifecycle boundaries — Model fitting, prediction, and state management are clearly separated to support reproducibility and controlled execution.
  • Comparability over abstraction — Adapters do not attempt to hide meaningful differences between modeling approaches; they exist to make comparison feasible, not to enforce uniformity.

Minimal Example

The example below shows how a forecasting model is wrapped behind a standardized adapter interface so it can be trained and evaluated consistently alongside other models.

from eb_adapters.statsmodels import StatsModelsAdapter
from statsmodels.tsa.arima.model import ARIMA

# Define a native model
model = ARIMA

# Wrap the model with an adapter
adapter = StatsModelsAdapter(
    model_class=model,
    model_kwargs={"order": (1, 1, 1)}
)

# Fit and predict using a standardized interface
adapter.fit(y_train)
y_pred = adapter.predict(horizon=7)

The same interface can be used with tree-based or machine-learning models via a different adapter:

from eb_adapters.xgboost import XGBoostAdapter
from xgboost import XGBRegressor

# Define a native model
model = XGBRegressor

# Wrap the model with an adapter
adapter = XGBoostAdapter(
    model_class=model,
    model_kwargs={"n_estimators": 200, "max_depth": 4}
)

# Fit and predict using the same contract
adapter.fit(X_train, y_train)
y_pred = adapter.predict(X_future)

License

BSD 3-Clause License.
© 2025 Kyle Corrie.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eb_adapters-0.2.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eb_adapters-0.2.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file eb_adapters-0.2.1.tar.gz.

File metadata

  • Download URL: eb_adapters-0.2.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for eb_adapters-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4928439b1d815f8d3286179fe54f5532058eaf8d5e5d97cb01ab40eb5ad91c0f
MD5 8587ffd7e3ed67d0ea7c861763f8b93f
BLAKE2b-256 6632409414d886af8a6559b7c08b72a6424c7a0d108f2f178d6ae0e569ed6a66

See more details on using hashes here.

Provenance

The following attestation bundles were made for eb_adapters-0.2.1.tar.gz:

Publisher: release.yml on Economistician/eb-adapters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eb_adapters-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: eb_adapters-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for eb_adapters-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2df9b2dbe9e3f3daa5b25eeb7d5448dc8485aa0e45fe93a5aca7c7887b10808f
MD5 917aeae431dc87dced74bd6e15d95f41
BLAKE2b-256 ec268cc6fb74f69b666158db9bc01610fa11bff71cf649560f22c5bb562ca575

See more details on using hashes here.

Provenance

The following attestation bundles were made for eb_adapters-0.2.1-py3-none-any.whl:

Publisher: release.yml on Economistician/eb-adapters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page