Docs /Templates/ sinapsis-sktime

ProphetPiecewiseLinearTrendForecasterSKTimeWrapper

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

ProphetPiecewiseLinearTrendForecaster — inherited documentation

Forecast time series data with a piecewise linear trend, fitted via prophet.

The forecaster uses Facebook's prophet algorithm [1]_ and extracts the piecewise linear trend from it. Only hyper-parameters relevant for the trend modelling are exposed via the constructor.

Seasonalities are set to additive and "auto" detection in prophet, which means that yearly, weekly and daily seasonality are automatically detected, and included in the model if present, using prophet's default settings.

For more granular control of components or seasonality, use ``sktime.forecasting.fbprophet.Prophet`` directly.

Data can be passed in one of the sktime compatible formats, naming a column ``ds`` such as in the prophet package is not necessary.

Unlike vanilla ``prophet``, also supports integer/range and period index: * integer/range index is interpreted as days since Jan 1, 2000 * ``PeriodIndex`` is converted using the ``pandas`` method ``to_timestamp``

Parameters ---------- changepoints: list or None, default=None List of dates at which to include potential changepoints. If not specified, potential changepoints are selected automatically. n_changepoints: int, default=25 Number of potential changepoints to include. Not used if input ``changepoints`` is supplied. If ``changepoints`` is not supplied, then n_changepoints potential changepoints are selected uniformly from the first ``changepoint_range`` proportion of the history. changepoint_range: float, default=0.8 Proportion of history in which trend changepoints will be estimated. Defaults to 0.8 for the first 80%. Not used if ``changepoints`` is specified. changepoint_prior_scale: float, default=0.05 Parameter modulating the flexibility of the automatic changepoint selection. Large values will allow many changepoints, small values will allow few changepoints. Recommended to take values within [0.001,0.5]. yearly_seasonality: str or bool or int, default=False Include yearly seasonality in the model. "auto" for automatic determination, True to enable, False to disable, or an integer specifying the number of terms to include in the Fourier series. weekly_seasonality: str or bool or int, default=False Include weekly seasonality in the model. "auto" for automatic determination, True to enable, False to disable, or an integer specifying the number of terms to include in the Fourier series. daily_seasonality: str or bool or int, default=False Include weekly seasonality in the model. "auto" for automatic determination, True to enable, False to disable, or an integer specifying the number of terms to include in the Fourier series.

References ---------- .. [1] https://facebook.github.io/prophet

Examples -------- >>> from sktime.datasets import load_airline >>> from sktime.forecasting.trend import ProphetPiecewiseLinearTrendForecaster >>> from sktime.forecasting.base import ForecastingHorizon >>> from sktime.split import temporal_train_test_split >>> y =load_airline().to_timestamp(freq='M') >>> y_train, y_test = temporal_train_test_split(y) >>> fh = ForecastingHorizon(y.index, is_relative=False) >>> forecaster = ProphetPiecewiseLinearTrendForecaster() # doctest: +SKIP >>> forecaster.fit(y_train) # doctest: +SKIP ProphetPiecewiseLinearTrendForecaster(...) >>> y_pred = forecaster.predict(fh) # doctest: +SKIP

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. prophetpiecewiselineartrendforecaster_init changepoints typing.Optional[list]: default: None n_changepoints <class 'int'>: default: 25 changepoint_range <class… Read full field description

Number of steps ahead to forecast. Defaults to 37. prophetpiecewiselineartrendforecaster_init changepoints typing.Optional[list]: default: None n_changepoints <class 'int'>: default: 25 changepoint_range <class 'float'>: default: 0.8 changepoint_prior_scale <class 'float'>: default: 0.05 yearly_seasonality typing.Optional[str]: default: False weekly_seasonality typing.Optional[str]: default: False daily_seasonality typing.Optional[str]: default: False

int
Optional
Default: 37
model_save_pathRequired
str
Required
Default: null
prophetpiecewiselineartrendforecaster_initRequired
ProphetPiecewiseLinearTrendForecasterAttributes
Required
Default: null
changepoints
typing.Optional[list]
Optional
Default: null
n_changepoints
int
Optional
Default: 25
changepoint_range
float
Optional
Default: 0.8
daily_seasonality
typing.Optional[str]
Optional
Default: false
weekly_seasonality
typing.Optional[str]
Optional
Default: false
yearly_seasonality
typing.Optional[str]
Optional
Default: false
changepoint_prior_scale
float
Optional
Default: 0.05

Configuration example

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

yaml
templates:
  - template_name: "ProphetPiecewiseLinearTrendForecasterSKTimeWrapper"
    class_name: "ProphetPiecewiseLinearTrendForecasterSKTimeWrapper"
    attributes:
      root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
      n_steps_ahead: 37
      model_save_path: "<required>"
      prophetpiecewiselineartrendforecaster_init:
        changepoints: null
        n_changepoints: 25
        changepoint_range: 0.8
        daily_seasonality: false
        weekly_seasonality: false
        yearly_seasonality: false
        changepoint_prior_scale: 0.05

Inheritance

Immediate parent: sinapsis_sktime.templates.sktime_forecasters.SKTimeTrendForecaster

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere