Skip to content

Base Adapter API

This section documents the core adapter interfaces and utilities used by eb-adapters.

All content below is generated automatically from NumPy-style docstrings in the source code.

Base Adapter Package

eb_adapters.base

BaseAdapter

Minimal base class defining the adapter contract for ElectricBarometer.

This class documents the expected interface for wrapping non-scikit-learn forecasting or regression engines so they can be evaluated and selected alongside native scikit-learn estimators.

Subclasses are expected to present a scikit-learn-like API:

  • fit(X, y, sample_weight=None) returning self
  • predict(X) returning a one-dimensional numpy array

The ElectricBarometer engine does not distinguish between native scikit-learn estimators and adapters; it simply calls fit and predict. This base class serves as a clear, documented contract for adapter authors.

fit(X, y, sample_weight=None)

Fit the underlying forecasting or regression model.

Parameters:

Name Type Description Default
X ndarray

Feature matrix. For pure time-series models, this may be ignored or used only for alignment.

required
y ndarray

One-dimensional target vector.

required
sample_weight ndarray | None

Optional per-sample weights. Adapters may ignore this argument if weighting is not supported by the underlying model.

None

Returns:

Type Description
BaseAdapter

The fitted adapter instance (self).

Raises:

Type Description
NotImplementedError

If the subclass does not override this method.

predict(X)

Generate predictions from the fitted model.

Parameters:

Name Type Description Default
X ndarray

Feature matrix used to generate predictions.

required

Returns:

Type Description
ndarray

One-dimensional array of predictions.

Raises:

Type Description
NotImplementedError

If the subclass does not override this method.