ExponentialSmoothingHyperparams
chronax.models.ExponentialSmoothingHyperparams
A Pydantic model defining the configuration parameters for the Exponential Smoothing model.
__init__(self, **data)
Initializes the hyperparameters, converting string "null" values to None.
| Parameter | Type | Default | Description |
|---|---|---|---|
| trend | Optional[Literal["add", "mul", "null"]] |
- | Trend component: 'add', 'mul', or None (no trend) |
| damped_trend | Optional[bool] |
False |
Whether to use damped trend |
| seasonal | Optional[Literal["add", "mul", "null"]] |
None |
Seasonal component: 'add', 'mul', or None (no seasonality) |
| seasonal_periods | Optional[Union[int, Literal["null"]]] |
None |
Number of seasonal periods (None if no seasonality) |
ExponentialSmoothingModel
chronax.models.ExponentialSmoothingModel · inherits BaseModel
Exponential Smoothing model implementation.
__init__(self, params: Dict[str, Any], settings: Dict[str, Any])
Initializes the Exponential Smoothing Model wrapper.
| 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) -> "ExponentialSmoothingModel"
Trains a separate Exponential Smoothing model for each variate in a (potentially multivariate) time series.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
| y_context | np.ndarray |
- | Historical target values for model fitting. Expects 2D arrays: (num_steps, num_targets). |
| y_target | np.ndarray |
- | Future target values (unused; included for compatibility). Expects 2D arrays: (num_steps, num_targets). |
| timestamps_context | np.ndarray |
- | Timestamps corresponding to y_context. |
| timestamps_target | np.ndarray |
- | Timestamps corresponding to y_target. |
| 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: ExponentialSmoothingModel (the fitted model instance).
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.)