ProphetHyperparams
prophet_model.ProphetHyperparams
This class defines the hyperparameters used to configure the underlying Prophet model.
__init__(self, **data)
Initializes the hyperparameter configuration and enforces that only one seasonality option (yearly_seasonality, weekly_seasonality, or daily_seasonality) can be enabled simultaneously.
| Parameter | Type | Default | Description |
|---|---|---|---|
growth |
Literal["linear", "logistic", "flat"] |
"linear" |
Growth type |
seasonality_mode |
Literal["additive", "multiplicative"] |
- | Seasonality mode |
changepoint_prior_scale |
float |
- | Changepoint prior scale |
seasonality_prior_scale |
float |
- | Seasonality prior scale |
yearly_seasonality |
Optional[Union[int, bool]] |
False |
Enable yearly seasonality (bool) or increase the number of Fourier terms (int) |
weekly_seasonality |
Optional[Union[int, bool]] |
False |
Enable weekly seasonality (bool) or increase the number of Fourier terms (int) |
daily_seasonality |
Optional[Union[int, bool]] |
False |
Enable daily seasonality (bool) or increase the number of Fourier terms (int) |
ProphetModel
prophet_model.ProphetModel
__init__(self, params: Dict[str, Any], settings: Dict[str, Any])
Initializes the ProphetModel, setting up hyperparameter validation using ProphetHyperparams.
| Parameter | Type | Default | Description |
|---|---|---|---|
params |
Dict[str, Any] |
- | (undocumented) |
settings |
Dict[str, Any] |
- | (undocumented) |
train(self, y_context: np.ndarray, y_target: np.ndarray, timestamps_context: np.ndarray, timestamps_target: np.ndarray, x_context: Optional[np.ndarray] = None, x_target: Optional[np.ndarray] = None, **kwargs: dict) -> ProphetModel
Trains a separate Prophet model for each variate in a (potentially multivariate) time series.
Expects y_context and y_target as 2D arrays: (num_steps, num_targets).
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
y_context |
np.ndarray |
- | Context values, shape (num_steps, num_targets). |
y_target |
np.ndarray |
- | Context values, shape (num_steps, num_targets). |
timestamps_context |
np.ndarray |
- | (undocumented) |
timestamps_target |
np.ndarray |
- | (undocumented) |
x_context |
Optional[np.ndarray] |
None |
(undocumented) |
x_target |
Optional[np.ndarray] |
None |
(undocumented) |
**kwargs |
dict |
- | Additional keyword arguments. |
Returns: ProphetModel (the fitted forecaster).
predict(self, y_context: np.ndarray, timestamps_context: np.ndarray, timestamps_target: np.ndarray, x_context: Optional[np.ndarray] = None, x_target: Optional[np.ndarray] = None, **kwargs: dict) -> np.ndarray
Predicts future values for each variate and concatenates the results.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
y_context |
np.ndarray |
- | Context values, shape (num_steps, num_variates). |
timestamps_context |
np.ndarray |
- | Timestamps for context data. |
timestamps_target |
np.ndarray |
- | Timestamps for target/future data. |
x_context |
Optional[np.ndarray] |
None |
Optional covariate data for context. |
x_target |
Optional[np.ndarray] |
None |
Optional covariate data for prediction horizon. |
**kwargs |
dict |
- | Additional keyword arguments. |
Returns: np.ndarray (Predictions with shape (forecast_horizon, num_variates)).
Raises: ValueError (If the model has not been fitted.)