Docs /Templates/ sinapsis-sktime

SplineTrendForecasterSKTimeWrapper

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

SplineTrendForecaster — inherited documentation

Forecast time series data with a spline trend.

Uses an ``sklearn`` regressor specified by the ``regressor`` parameter to perform regression on time series values against their corresponding indices, after transformation of the indices with ``SplineTransformer``.

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

n_knots : int, default=5 Number of knots of the splines if ``knots`` is one of {'uniform', 'quantile'}. Must be at least 2. Ignored if ``knots`` is array-like.

degree : int, default=1 Degree of the splines (1 for linear, 2 for quadratic, etc.). n_knots : int, default=4 Number of knots for the spline transformation.

knots : {'uniform', 'quantile'}or array-like of shape (n_knots, n_features), default='uniform' Determines knot positions such that first knot <= features <= last knot.

- 'uniform': `n_knots` are distributed uniformly between the min and max values of the features. - 'quantile': `n_knots` are distributed uniformly along the quantiles of the features. - array-like: Specifies sorted knot positions, including the boundary knots. Internally, additional knots are added before the first knot and after the last knot based on the spline degree.

extrapolation : {'error', 'constant', 'linear', 'continue', 'periodic'}, default='constant' Determines how to handle values outside the min and max values of the training features:

- 'error': Raises a ValueError. - 'constant': Uses the spline value at the minimum or maximum feature as constant extrapolation. - 'linear': Applies linear extrapolation. - 'continue': Extrapolates as is (equivalent to `extrapolate=True` in `scipy.interpolate.BSpline`). - 'periodic': Uses periodic splines with a periodicity equal to the distance between the first and last knot, enforcing equal function values and derivatives at these knots.

with_intercept : bool, default=True If True, includes a feature in which all polynomial powers are zero (i.e., a column of ones, acting as an intercept term in a linear model).

Examples -------- >>> from sktime.datasets import load_airline >>> from sktime.forecasting.trend import SplineTrendForecaster >>> y = load_airline() >>> forecaster = SplineTrendForecaster( ... n_knots=5, ... degree=2, ... knots="uniform", ... extrapolation="constant" ... ) >>> forecaster.fit(y) SplineTrendForecaster(...) >>> 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. splinetrendforecaster_init regressor <class 'NoneType'>: default: None n_knots <class 'int'>: default: 5 degree <class 'int'>: default: 1 knots typing.Union[str,… Read full field description

Number of steps ahead to forecast. Defaults to 37. splinetrendforecaster_init regressor <class 'NoneType'>: default: None n_knots <class 'int'>: default: 5 degree <class 'int'>: default: 1 knots typing.Union[str, typing.Any, NoneType]: default: uniform extrapolation typing.Union[str, typing.Any, NoneType]: default: constant with_intercept <class 'bool'>: default: True

int
Optional
Default: 37
model_save_pathRequired
str
Required
Default: null
splinetrendforecaster_initRequired
SplineTrendForecasterAttributes
Required
Default: null
knots
typing.Union[str, typing.Any, NoneType]
Optional
Default: "uniform"
degree
int
Optional
Default: 1
n_knots
int
Optional
Default: 5
regressor
NoneType
Optional
Default: null
extrapolation
typing.Union[str, typing.Any, NoneType]
Optional
Default: "constant"
with_intercept
bool
Optional
Default: true

Configuration example

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

yaml
templates:
  - template_name: "SplineTrendForecasterSKTimeWrapper"
    class_name: "SplineTrendForecasterSKTimeWrapper"
    attributes:
      root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
      n_steps_ahead: 37
      model_save_path: "<required>"
      splinetrendforecaster_init:
        knots: "uniform"
        degree: 1
        n_knots: 5
        regressor: null
        extrapolation: "constant"
        with_intercept: true

Inheritance

Immediate parent: sinapsis_sktime.templates.sktime_forecasters.SKTimeTrendForecaster

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere