ThetaModularForecasterSKTimeWrapper
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
ThetaModularForecaster — inherited documentation
Modular theta method for forecasting.
Modularized implementation of Theta method as defined in [1]_. Also see auto-theta method as described in [2]_ *not contained in this estimator).
Overview: Input :term:`univariate series <Univariate time series>` of length "n" and decompose with :class:`ThetaLinesTransformer <sktime.transformations.theta>` by modifying the local curvature of the time series using Theta-coefficient values - ``theta_values`` parameter. Thansformation gives a pd.DataFrame of shape ``len(input series) * len(theta)``.
The resulting transformed series (Theta-lines) are extrapolated separately. The forecasts are then aggregated into one prediction - aunivariate series, of ``len(fh)``.
Parameters ---------- forecasters: list of tuples (str, estimator, int or pd.index), default=None Forecasters to apply to each Theta-line based on the third element (the index). Indices must correspond to the theta_values, see Examples. If None, will apply PolynomialTrendForecaster (linear regression) to the Theta-lines where theta_value equals 0, and ExponentialSmoothing - where theta_value is different from 0. theta_values: sequence of float, default=(0,2) Theta-coefficients to use in transformation. If ``forecasters`` parameter is passed, must be the same length as ``forecasters``. aggfunc: str, default="mean" Must be one of ["mean", "median", "min", "max", "gmean"]. Calls :func:`_aggregate` of :class:`EnsembleForecaster<sktime.forecasting.compose._ensemble>` to apply to results of multivariate theta-lines predictions (pd.DataFrame) in order to get resulting univariate prediction (pd.Series). The aggregation takes place across different theta-lines (row-wise), for given time stamps and hierarchy indices, if present. weights: list of floats, default=None Weights to apply in aggregation. Weights are passed as a parameter to the aggregation function, must correspond to each theta-line. None will result in non-weighted aggregation.
References ---------- .. [1] V.Assimakopoulos et al., "The theta model: a decomposition approach to forecasting", International Journal of Forecasting, vol. 16, pp. 521-530, 2000. .. [2] E.Spiliotis et al., "Generalizing the Theta method for automatic forecasting ", European Journal of Operational Research, vol. 284, pp. 550-558, 2020.
See Also -------- ThetaForecaster, ThetaLinesTransformer
Examples -------- >>> from sktime.datasets import load_airline >>> from sktime.forecasting.theta import ThetaModularForecaster >>> from sktime.forecasting.naive import NaiveForecaster >>> from sktime.forecasting.trend import PolynomialTrendForecaster >>> y = load_airline() >>> forecaster = ThetaModularForecaster( ... forecasters=[ ... ("trend", PolynomialTrendForecaster(), 0), ... ("arima", NaiveForecaster(), 3), ... ], ... theta_values=(0, 3), ... ) >>> forecaster.fit(y) ThetaModularForecaster(...) >>> 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. thetamodularforecaster_init forecasters <class 'NoneType'>: default: None theta_values <class 'tuple'>: default: (0, 2) aggfunc <class 'str'>: default: mean weights <class 'NoneType'>: default: None
Optional
Default: 37
Required
Default: null
Required
Default: null
Optional
Default: "mean"
Optional
Default: null
Optional
Default: null
Optional
Default: [0,2]
Configuration example
Generated from documented defaults. Replace any placeholders and complete required nested settings before running.
templates:
- template_name: "ThetaModularForecasterSKTimeWrapper"
class_name: "ThetaModularForecasterSKTimeWrapper"
attributes:
root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
n_steps_ahead: 37
model_save_path: "<required>"
thetamodularforecaster_init:
aggfunc: "mean"
weights: null
forecasters: null
theta_values: {}
Inheritance
sinapsis_sktime.templates.sktime_forecasters.SKTimeThetaForecasterEnvironment variables
Environment definitions belong to their canonical Python modules.