ThetaForecasterSKTimeWrapper
Python template · sinapsis_sktime.templates.sktime_forecasters
Overview
This template specifically handles sktime series forecasting tasks.
The goal is to train a model and predict future values of the input time series.
Attributes: WrapperEntry (WrapperEntryConfig): Configuration for dynamic template generation TASK_TYPE (str): The type of task (forecasting) CATEGORY (str): The category of the template AttributesBaseModel: Reference to the attributes' model class
ThetaForecaster — inherited documentation
Theta method for forecasting.
The theta method as defined in [1]_ is equivalent to simple exponential smoothing (SES) with drift (as demonstrated in [2]_).
The series is tested for seasonality using the test outlined in A&N. If deemed seasonal, the series is seasonally adjusted using a classical multiplicative decomposition before applying the theta method. The resulting forecasts are then reseasonalised.
In cases where SES results in a constant forecast, the theta forecaster will revert to predicting the SES constant plus a linear trend derived from the training data.
Prediction intervals are computed using the underlying state space model.
Parameters ---------- initial_level : float, optional The alpha value of the simple exponential smoothing, if the value is set then this will be used, otherwise it will be estimated from the data. deseasonalize : bool, optional (default=True), or sktime BaseTransformer instance Whether and how to deseasonalize the data before fitting the theta model.
* If True, data is seasonally adjusted using ``sktime`` ``Deseasonalizer()``. * If BaseTransformer instance, this is used to seasonally adjust the data, via ``fit_transform`` in fit, and ``inverse_transform`` in predict. * If False, no seasonal adjustment is done.
sp : int, optional (default=1) The number of observations that constitute a seasonal period for a multiplicative deseasonaliser, which is used if seasonality is detected in the training data. Ignored if a deseasonaliser transformer is provided. Default is 1 (no seasonality). deseasonalize_model : str, optional (default="multiplicative") The type of seasonal decomposition to use in the deseasonaliser. Can be "additive" or "multiplicative". Passed on to ``Deseasonalizer`` if ``deseasonalize=True``. Only used if ``deseasonalize=True``.
Attributes ---------- initial_level_ : float The estimated alpha value of the SES fit. drift_ : float The estimated drift of the fitted model. se_ : float The standard error of the predictions. Used to calculate prediction intervals.
References ---------- .. [1] Assimakopoulos, V. and Nikolopoulos, K. The theta model: a decomposition approach to forecasting. International Journal of Forecasting 16, 521-530, 2000. https://www.sciencedirect.com/science/article/pii/S0169207000000662
.. [2] `Hyndman, Rob J., and Billah, Baki. Unmasking the Theta method. International J. Forecasting, 19, 287-290, 2003. https://www.sciencedirect.com/science/article/pii/S0169207001001431
See Also -------- StatsForecastAutoTheta
Examples -------- >>> from sktime.datasets import load_airline >>> from sktime.forecasting.theta import ThetaForecaster >>> y = load_airline() >>> forecaster = ThetaForecaster(sp=12) >>> forecaster.fit(y) ThetaForecaster(...) >>> y_pred = forecaster.predict(fh=[1,2,3])
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-sktime==1.0.0uv pip install sinapsis-sktime==1.0.0uv add sinapsis-sktime==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Optional
Default: null
Optional
Default: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
Number of steps ahead to forecast. Defaults to 37. thetaforecaster_init initial_level typing.Optional[float]: default: None deseasonalize <class 'bool'>: default: True sp <class 'int'>: default: 1 deseasonalize_model <class 'str'>: default: multiplicative
Optional
Default: 37
Required
Default: null
Required
Default: null
Optional
Default: 1
Optional
Default: true
Optional
Default: null
Optional
Default: "multiplicative"
Configuration example
Generated from documented defaults. Replace any placeholders and complete required nested settings before running.
templates:
- template_name: "ThetaForecasterSKTimeWrapper"
class_name: "ThetaForecasterSKTimeWrapper"
attributes:
root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
n_steps_ahead: 37
model_save_path: "<required>"
thetaforecaster_init:
sp: 1
deseasonalize: true
initial_level: null
deseasonalize_model: "multiplicative"
Inheritance
sinapsis_sktime.templates.sktime_forecasters.SKTimeThetaForecasterEnvironment variables
Environment definitions belong to their canonical Python modules.