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.1.1.tar.gz (13.0 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.1.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eb_adapters-0.1.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for eb_adapters-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2af15190b7f466b391b4444b7ddadfb7582ed4a6be5ed960a4bbdc46212ded90
MD5 0f5f20587152dda267117512c2bcbb5a
BLAKE2b-256 c4d9edb635300885245000b459bb691766a82a53c7f2a3740a2aeebf94d1abe8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: eb_adapters-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for eb_adapters-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6441ee01c58344b25a18736150d508d88923dee2ba12595a42ab21ac9792268d
MD5 93d762a2df11f8154c6809d7c9f09f0c
BLAKE2b-256 912fe671fea85ec8f8ecc2421df99b2e0b37e8484aae9927410223355abb6882

See more details on using hashes here.

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