NaiveVarianceSKTimeWrapper
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
NaiveVariance — inherited documentation
Compute the prediction variance based on a naive strategy.
NaiveVariance adds to a ``forecaster`` the ability to compute the prediction variance based on naive assumptions about the time series. The simple strategy is as follows: - Let :math:`y_1,\dots,y_T` be the time series we fit the estimator :math:`f` to. - Let :math:`\widehat{y}_{ij}` be the forecast for time point :math:`j`, obtained from fitting the forecaster to the partial time series :math:`y_1,\dots,y_i`. - We compute the residuals matrix :math:`R=(r_{ij})=(y_j-\widehat{y}_{ij})`. - The variance prediction :math:`v_k` for :math:`y_{T+k}` is :math:`\frac{1}{T-k}\sum_{i=1}^{T-k} a_{i,i+k}^2` because we are averaging squared residuals of all forecasts that are :math:`k` time points ahead. - And for the covariance matrix prediction, the formula becomes :math:`Cov(y_k, y_l)=\frac{\sum_{i=1}^N \hat{r}_{k,k+i}*\hat{r}_{l,l+i}}{N}`.
The resulting forecaster will implement ``predict_interval``, ``predict_quantiles``, ``predict_var``, and ``predict_proba``, even if the wrapped forecaster ``forecaster`` did not have this capability; for point forecasts (``predict``), behaves like the wrapped forecaster.
Parameters ---------- forecaster : estimator Estimator to which probabilistic forecasts are being added initial_window : int, optional, default=1 number of minimum initial indices to use for fitting when computing residuals verbose : bool, optional, default=False whether to print warnings if windows with too few data points occur
Examples -------- >>> from sktime.datasets import load_airline >>> from sktime.forecasting.naive import NaiveForecaster, NaiveVariance >>> y = load_airline() >>> forecaster = NaiveForecaster(strategy="drift") >>> variance_forecaster = NaiveVariance(forecaster) >>> variance_forecaster.fit(y) NaiveVariance(...) >>> var_pred = variance_forecaster.predict_var(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. naivevariance_init forecaster <class 'type'>: default: <class 'inspect._empty'> initial_window <class 'int'>: default: 1 verbose <class 'bool'>: default: False
Optional
Default: 37
Required
Default: null
Required
Default: null
Optional
Default: false
Optional
Default: null
Optional
Default: 1
Configuration example
Generated from documented defaults. Replace any placeholders and complete required nested settings before running.
templates:
- template_name: "NaiveVarianceSKTimeWrapper"
class_name: "NaiveVarianceSKTimeWrapper"
attributes:
root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
n_steps_ahead: 37
model_save_path: "<required>"
naivevariance_init:
verbose: false
forecaster: {}
initial_window: 1
Inheritance
sinapsis_sktime.templates.sktime_forecasters.SKTimeNaiveForecasterEnvironment variables
Environment definitions belong to their canonical Python modules.