Docs /Templates/ sinapsis-darts-forecasting

ExponentialSmoothingWrapper

sinapsis-darts-forecastingDartsdartsdynamicforecastingmodels

Python template · sinapsis_darts_forecasting.templates.time_series_model

Overview

Base Template for Darts Time Series forecasting models.

ExponentialSmoothing — inherited documentation

The base class for "local" forecasting models, handling only single univariate time series.

Local Forecasting Models (LFM) are models that can be trained on a single univariate target series only. In Darts, most models in this category tend to be simpler statistical models (such as ETS or FFT). LFMs usually train on the entire target series supplied when calling :func:`fit()` at once. They can also predict in one go with :func:`predict()` for any number of predictions `n` after the end of the training series.

All implementations must implement the `fit()` and `predict()` methods.Exponential Smoothing

This is a wrapper around `statsmodels Holt-Winters' Exponential Smoothing <https://www.statsmodels.org/stable/generated/statsmodels.tsa.holtwinters.ExponentialSmoothing.html>`__; we refer to this link for the original and more complete documentation of the parameters.

`trend` must be a ``ModelMode`` Enum member. You can access the Enum with ``from darts.utils.utils import ModelMode``. `seasonal` must be a ``SeasonalityMode`` Enum member. You can access the Enum with ``from darts.utils.utils import SeasonalityMode``.

``ExponentialSmoothing(trend=ModelMode.NONE, seasonal=SeasonalityMode.NONE)`` corresponds to a single exponential smoothing. ``ExponentialSmoothing(trend=ModelMode.ADDITIVE, seasonal=SeasonalityMode.NONE)`` corresponds to a Holt's exponential smoothing.

Please note that automatic `seasonal_period` selection (setting the `seasonal_periods` parameter equal to `None`) can sometimes lead to errors if the input time series is too short. In these cases we suggest to manually set the `seasonal_periods` parameter to a positive integer.

Parameters ---------- trend Type of trend component. Either ``ModelMode.ADDITIVE``, ``ModelMode.MULTIPLICATIVE``, ``ModelMode.NONE``, or ``None``. Defaults to ``ModelMode.ADDITIVE``. damped Should the trend component be damped. Defaults to False. seasonal Type of seasonal component. Either ``SeasonalityMode.ADDITIVE``, ``SeasonalityMode.MULTIPLICATIVE``, ``SeasonalityMode.NONE``, or ``None``. Defaults to ``SeasonalityMode.ADDITIVE``. seasonal_periods The number of periods in a complete seasonal cycle, e.g., 4 for quarterly data or 7 for daily data with a weekly cycle. If not set, inferred from frequency of the series. error Specifies the type of error model for state space formulation to use when using predict() with ``num_samples > 1``. Default is `"add"`. Will be passed to statsmodels' :func:`simulate()` method. See the documentation `here <https://www.statsmodels.org/stable/generated/statsmodels.tsa.holtwinters.HoltWintersResults.simulate.html>`__ for more information. random_errors Specifies how the random errors should be obtained, when using predict() with ``num_samples > 1``. Will be passed to statsmodels' :func:`simulate()` method. See the documentation `here <https://www.statsmodels.org/stable/generated/statsmodels.tsa.holtwinters.HoltWintersResults.simulate.html>`__ for more information. random_state Controls the randomness for reproducible forecasting. kwargs Some optional keyword arguments that will be used to call :func:`statsmodels.tsa.holtwinters.ExponentialSmoothing()`. See `the documentation <https://www.statsmodels.org/stable/generated/statsmodels.tsa.holtwinters.ExponentialSmoothing.html>`__. fit_kwargs Some optional keyword arguments that will be used to call :func:`statsmodels.tsa.holtwinters.ExponentialSmoothing.fit()`. See `the documentation <https://www.statsmodels.org/stable/generated/statsmodels.tsa.holtwinters.ExponentialSmoothing.fit.html>`__.

Examples -------- >>> from darts.datasets import AirPassengersDataset >>> from darts.models import ExponentialSmoothing >>> from darts.utils.utils import ModelMode, SeasonalityMode >>> series = AirPassengersDataset().load() >>> # using Holt's exponential smoothing >>> model = ExponentialSmoothing(trend=ModelMode.ADDITIVE, seasonal=SeasonalityMode.MULTIPLICATIVE) >>> model.fit(series) >>> pred = model.predict(6) >>> print(pred.values()) [[445.24283838] [418.22618932] [465.31305075] [494.95129261] [505.4770514 ] [573.31519186]]

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-darts-forecasting==1.0.0
uv pip install sinapsis-darts-forecasting==1.0.0
uv add sinapsis-darts-forecasting==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
validation_mode
bool
Optional
Default: false
forecast_horizon
int
Optional
Default: 10
exponentialsmoothing_initRequired
BaseModel
Required
Default: null

Configuration example

Generated from documented defaults. Replace any placeholders and complete required nested settings before running.

yaml
templates:
  - template_name: "ExponentialSmoothingWrapper"
    class_name: "ExponentialSmoothingWrapper"
    attributes:
      validation_mode: false
      forecast_horizon: 10
      exponentialsmoothing_init: {}
View original docstring example

The source example references XGBModelWrapper, not ExponentialSmoothingWrapper.

yaml
agent:
    name: my_test_agent
templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: XGBModelWrapper
  class_name: XGBModelWrapper
  template_input: InputTemplate
  attributes:
    forecast_horizon: 100
    xgbmodel_init:
        lags: 30
        lags_past_covariates: 30
        output_chunk_length: 100
        random_state: 42
        n_estimators: 200
        learning_rate: 0.1
        max_depth: 6
For a full list of options use the sinapsis cli: sinapsis info --all-template-names.
If you want to see all available models, please visit:
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.html

Inheritance

Immediate parent: sinapsis_darts_forecasting.templates.time_series_model.TimeSeriesModel

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere