Docs /Templates/ sinapsis-sktime

TrendForecasterSKTimeWrapper

sinapsis-sktimeSKTimedynamicinferencemodelsprediction

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

TrendForecaster — inherited documentation

Trend based forecasts of time series data, regressing values on index.

Uses an ``sklearn`` regressor specified by the ``regressor`` parameter to perform regression on time series values against their corresponding indices, providing trend-based forecasts:

In ``fit``, for input time series :math:`(v_i, t_i), i = 1, \dots, T`, where :math:`v_i` are values and :math:`t_i` are time stamps, fits an ``sklearn`` model :math:`v_i = f(t_i) + \epsilon_i`, where :math:`f` is the model fitted when ``regressor.fit`` is passed ``X`` = vector of :math:`t_i`, and ``y`` = vector of :math:`v_i`.

In ``predict``, for a new time point :math:`t_*`, predicts :math:`f(t_*)`, where :math:`f` is the function as fitted above in ``fit``.

Default for ``regressor`` is linear regression = ``sklearn`` ``LinearRegression``, with default parameters.

If time stamps are ``pd.DatetimeIndex``, fitted coefficients are in units of days since start of 1970. If time stamps are ``pd.PeriodIndex``, coefficients are in units of (full) periods since start of 1970.

Parameters ---------- regressor : estimator object, default = None Define the regression model type. If not set, will default to sklearn.linear_model.LinearRegression

Attributes ---------- regressor_ : sklearn regressor estimator object The fitted regressor object. Clone of ``regressor``.

Examples -------- >>> from sktime.datasets import load_airline >>> from sktime.forecasting.trend import TrendForecaster >>> y = load_airline() >>> forecaster = TrendForecaster() >>> forecaster.fit(y) TrendForecaster(...) >>> y_pred = forecaster.predict(fh=[1,2,3])

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-sktime==1.0.0
uv pip install sinapsis-sktime==1.0.0
uv add sinapsis-sktime==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
root_dir
str
Optional
Default: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
n_steps_ahead

Number of steps ahead to forecast. Defaults to 37. trendforecaster_init regressor <class 'NoneType'>: default: None

int
Optional
Default: 37
model_save_pathRequired
str
Required
Default: null
trendforecaster_initRequired
TrendForecasterAttributes
Required
Default: null
regressor
NoneType
Optional
Default: null

Configuration example

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

yaml
templates:
  - template_name: "TrendForecasterSKTimeWrapper"
    class_name: "TrendForecasterSKTimeWrapper"
    attributes:
      root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
      n_steps_ahead: 37
      model_save_path: "<required>"
      trendforecaster_init:
        regressor: null

Inheritance

Immediate parent: sinapsis_sktime.templates.sktime_forecasters.SKTimeTrendForecaster

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere