Prophet Adapter API¶
This section documents the Prophet adapter used to integrate
prophet.Prophet into the eb-adapters package.
All content below is generated automatically from NumPy-style docstrings in the source code.
Prophet Adapter Module¶
eb_adapters.prophet
¶
ProphetAdapter
¶
Bases: BaseAdapter
Adapter for prophet.Prophet.
This adapter enables Prophet models to be used inside ElectricBarometer or other CWSL-based evaluation workflows by exposing a scikit-learn-like API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Any | None
|
Optional pre-configured |
None
|
Notes
Input conventions:
Xencodes the time index as either:- shape (n_samples,) of datetime-like values, or
- shape (n_samples, n_features) where the first column is datetime-like
yis a one-dimensional array-like of numeric targets.
At fit time, the adapter constructs a DataFrame with columns:
ds: timestamps parsed fromXy: targets fromy
and calls Prophet.fit(df).
At predict time, the adapter constructs a DataFrame with column ds and
returns the yhat predictions as a one-dimensional numpy array.
Examples:
>>> from prophet import Prophet
>>> base = Prophet()
>>> model = ProphetAdapter(model=base)
>>> # X contains datetimes, y contains numeric targets
>>> # model.fit(X, y).predict(X)
fit(X, y, sample_weight=None)
¶
Fit the underlying Prophet model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Time index values. Accepted forms are: - shape (n_samples,) of datetime-like values, or - shape (n_samples, n_features) where the first column is datetime-like |
required |
y
|
ndarray
|
Target vector of shape (n_samples,). |
required |
sample_weight
|
ndarray | None
|
Accepted for API compatibility but ignored by this adapter. |
None
|
Returns:
| Type | Description |
|---|---|
ProphetAdapter
|
The fitted adapter (self), allowing method chaining. |
Notes
This method imports pandas locally to avoid making pandas a hard dependency at module import time.
predict(X)
¶
Predict using the fitted Prophet model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Time index values in the same format accepted by |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Predicted values of shape (n_samples,), taken from Prophet's |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the Prophet forecast output does not contain the |
Notes
This method imports pandas locally to avoid making pandas a hard dependency at module import time.