Forecasting#

The sktime.forecasting module contains algorithms and composition tools for forecasting.

All forecasters in sktime can be listed using the sktime.registry.all_estimators utility, using estimator_types="forecaster", optionally filtered by tags. Valid tags can be listed using sktime.registry.all_tags.

Base#

BaseForecaster()

Base forecaster template class.

ForecastingHorizon([values, is_relative, freq])

Forecasting horizon.

Pipeline composition#

Compositors for building forecasting pipelines. Pipelines can also be constructed using *, **, +, and | dunders.

make_pipeline(*steps)

Create a pipeline from estimators of any type.

TransformedTargetForecaster(steps)

Meta-estimator for forecasting transformed time series.

ForecastingPipeline(steps)

Pipeline for forecasting with exogenous data.

ColumnEnsembleForecaster(forecasters)

Forecast each series with separate forecaster.

MultiplexForecaster(forecasters[, ...])

MultiplexForecaster for selecting among different models.

ForecastX(forecaster_y[, forecaster_X, ...])

Forecaster that forecasts exogeneous data for use in an endogeneous forecast.

ForecastByLevel(forecaster[, groupby])

Forecast by instance or panel.

Permute(estimator[, permutation, steps_arg])

Permutation compositor for permuting forecasting pipeline steps.

HierarchyEnsembleForecaster(forecasters[, ...])

Aggregates hierarchical data, fit forecasters and make predictions.

TransformSelectForecaster(forecasters[, ...])

Compositor that utilizes varying forecasters by time series data's nature.

FhPlexForecaster(forecaster[, fh_params, ...])

Uses different parameters by forecasting horizon element.

IgnoreX(forecaster[, ignore_x])

Compositor for ignoring exogenous variables.

FallbackForecaster(forecasters[, verbose, ...])

Forecaster that sequentially tries a list of forecasting models.

Reduction#

Reduction forecasters that use sklearn regressors or sktime time series regressors to make forecasts.

Concurrent tabular strategy#

Uses exogeneous data at the same time stamp - simple reduction strategy.

YfromX(estimator[, pooling])

Simple reduction predicting endogeneous from concurrent exogeneous variables.

Direct and recursive - sktime native 1st generation#

1st generation direct and recursive reduction forecasters, numpy based.

Different strategies can be constructed via make_reduction for easy specification.

make_reduction(estimator[, strategy, ...])

Make forecaster based on reduction to tabular or time-series regression.

DirectTabularRegressionForecaster(estimator)

Direct reduction from forecasting to tabular regression.

DirectTimeSeriesRegressionForecaster(estimator)

Direct reduction from forecasting to time-series regression.

MultioutputTabularRegressionForecaster(estimator)

Multioutput reduction from forecasting to tabular regression.

MultioutputTimeSeriesRegressionForecaster(...)

Multioutput reduction from forecasting to time series regression.

RecursiveTabularRegressionForecaster(estimator)

Recursive reduction from forecasting to tabular regression.

RecursiveTimeSeriesRegressionForecaster(...)

Recursive reduction from forecasting to time series regression.

DirRecTabularRegressionForecaster(estimator)

Dir-rec reduction from forecasting to tabular regression.

DirRecTimeSeriesRegressionForecaster(estimator)

Dir-rec reduction from forecasting to time-series regression.

Direct and recursive - sktime native 2nd generation#

2nd generation rearchitecture of direct and recursive reduction forecasters, pandas based.

DirectReductionForecaster(estimator[, ...])

Direct reduction forecaster, incl single-output, multi-output, exogeneous Dir.

Direct and recursive - 3rd party#

SkforecastAutoreg(regressor, lags[, ...])

Adapter for skforecast.ForecasterAutoreg.ForecasterAutoreg class [Rab014607127f-1].

Naive forecasters#

NaiveForecaster([strategy, window_length, sp])

Forecast based on naive assumptions about past trends continuing.

ForecastKnownValues(y_known[, method, ...])

Forecaster that plays back known or prescribed values as forecasts.

Prediction intervals#

Wrappers that add prediction intervals to any forecaster.

SquaringResiduals([forecaster, ...])

Compute the prediction variance based on a separate forecaster.

NaiveVariance(forecaster[, initial_window, ...])

Compute the prediction variance based on a naive strategy.

ConformalIntervals(forecaster[, method, ...])

Empirical and conformal prediction intervals.

BaggingForecaster([bootstrap_transformer, ...])

Forecast a time series by aggregating forecasts from its bootstraps.

EnbPIForecaster([forecaster, ...])

Ensemble Bootstrap Prediction Interval Forecaster.

Trend forecasters#

TrendForecaster([regressor])

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

PolynomialTrendForecaster([regressor, ...])

Forecast time series data with a polynomial trend.

STLForecaster([sp, seasonal, trend, ...])

Implements STLForecaster based on statsmodels.tsa.seasonal.STL implementation.

CurveFitForecaster(function[, ...])

The CurveFitForecaster takes a function and fits it by using scipy curve_fit.

ProphetPiecewiseLinearTrendForecaster([...])

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

StatsForecastMSTL(season_length[, ...])

StatsForecast Multiple Seasonal-Trend decomposition using LOESS model.

Exponential smoothing based forecasters#

ExponentialSmoothing([trend, damped_trend, ...])

Holt-Winters exponential smoothing forecaster.

AutoETS([error, trend, damped_trend, ...])

ETS models with both manual and automatic fitting capabilities.

StatsForecastAutoETS([season_length, model, ...])

StatsForecast Automatic Exponential Smoothing model.

StatsForecastAutoCES([season_length, model])

StatsForecast Complex Exponential Smoothing model.

ThetaForecaster([initial_level, ...])

Theta method for forecasting.

StatsForecastAutoTheta([season_length, ...])

Statsforecast AutoTheta estimator.

AR/MA type forecasters#

Forecasters with AR or MA component.

All “ARIMA” and “Auto-ARIMA” models below include SARIMAX capability.

(V)AR(I)MAX models#

AutoREG([lags, trend, seasonal, hold_back, ...])

Autoregressive AR-X(p) model.

ARIMA([order, seasonal_order, start_params, ...])

(S)ARIMA(X) forecaster, from pmdarima package.

StatsModelsARIMA([order, seasonal_order, ...])

(S)ARIMA(X) forecaster, from statsmodels, tsa.arima module.

SARIMAX([order, seasonal_order, trend, ...])

(S)ARIMA(X) forecaster, from statsmodels, tsa.statespace module.

VAR([maxlags, method, verbose, trend, ...])

VAR model from statsmodels.

VARMAX([order, trend, error_cov_type, ...])

Wrapper for statsmodels VARMAX model.

Auto-ARIMA models#

AutoARIMA([start_p, d, start_q, max_p, ...])

Auto-(S)ARIMA(X) forecaster, from pmdarima package.

StatsForecastAutoARIMA([start_p, d, ...])

StatsForecast AutoARIMA estimator.

ARCH models#

StatsForecastARCH([p])

StatsForecast ARCH estimator.

StatsForecastGARCH([p, q])

StatsForecast GARCH estimator.

ARCH([mean, lags, vol, p, o, q, power, ...])

Directly interfaces ARCH models from python package arch.

Structural time series models#

ARDL([lags, order, fixed, causal, trend, ...])

Autoregressive Distributed Lag (ARDL) Model.

BATS([use_box_cox, box_cox_bounds, ...])

BATS forecaster for time series with multiple seasonality.

TBATS([use_box_cox, box_cox_bounds, ...])

TBATS forecaster for time series with multiple seasonality.

StatsForecastAutoTBATS(seasonal_periods[, ...])

StatsForecast TBATS model.

Prophet([freq, add_seasonality, ...])

Prophet forecaster by wrapping Facebook's prophet algorithm [R995275cbd543-1].

Prophetverse([changepoint_interval, ...])

Univariate prophetverse forecaster - prophet model implemented in numpyro.

UnobservedComponents([level, trend, ...])

Wrapper class of the UnobservedComponents model from statsmodels.

DynamicFactor([k_factors, factor_order, ...])

Dynamic Factor Forecaster.

Deep learning based forecasters#

LTSFLinearForecaster(seq_len, pred_len, *[, ...])

LTSF-Linear Forecaster.

LTSFDLinearForecaster(seq_len, pred_len, *)

LTSF-DLinear Forecaster.

LTSFNLinearForecaster(seq_len, pred_len, *)

LTSF-NLinear Forecaster.

HFTransformersForecaster(model_path[, ...])

Forecaster that uses a huggingface model for forecasting.

CINNForecaster([n_coupling_layers, ...])

Conditional Invertible Neural Network (cINN) Forecaster.

NeuralForecastRNN([freq, local_scaler_type, ...])

NeuralForecast RNN model.

NeuralForecastLSTM([freq, ...])

NeuralForecast LSTM model.

PytorchForecastingTFT([model_params, ...])

pytorch-forecasting Temporal Fusion Transformer model.

PytorchForecastingNBeats([model_params, ...])

pytorch-forecasting NBeats model.

PyKANForecaster([hidden_layers, ...])

PyKANForecaster uses Kolmogorov Arnold Network [1] to forecast time series data.

Intermittent time series forecasters#

Croston([smoothing])

Croston's method for forecasting intermittent time series.

Ensembles and stacking#

EnsembleForecaster(forecasters[, n_jobs, ...])

Ensemble of forecasters.

AutoEnsembleForecaster(forecasters[, ...])

Automatically find best weights for the ensembled forecasters.

StackingForecaster(forecasters[, regressor, ...])

StackingForecaster.

Hierarchical reconciliation#

ReconcilerForecaster(forecaster[, method])

Hierarchical reconciliation forecaster.

Online and stream forecasting#

OnlineEnsembleForecaster(forecasters[, ...])

Online Updating Ensemble of forecasters.

NormalHedgeEnsemble([n_estimators, a, loss_func])

Parameter free hedging algorithm.

NNLSEnsemble([n_estimators, loss_func])

Ensemble forecasts with Non-negative least squares based weighting.

UpdateEvery(forecaster[, update_interval])

Update only periodically when update is called.

UpdateRefitsEvery(forecaster[, ...])

Refits periodically when update is called.

DontUpdate(forecaster)

Turns off updates, i.e., ensures that forecaster is only fit and never updated.

Adapters to other forecasting framework packages#

Generic framework adapters that expose other frameworks in the sktime interface.

HCrystalBallAdapter(model)

Adapter for using hcrystalball forecasters in sktime.

Model selection and tuning#

ForecastingGridSearchCV(forecaster, cv, ...)

Perform grid-search cross-validation to find optimal model parameters.

ForecastingRandomizedSearchCV(forecaster, ...)

Perform randomized-search cross-validation to find optimal model parameters.

ForecastingSkoptSearchCV(forecaster, cv, ...)

Bayesian search over hyperparameters for a forecaster.

ForecastingOptunaSearchCV(forecaster, cv, ...)

Perform Optuna search cross-validation to find optimal model hyperparameters.

Model Evaluation (Backtesting)#

evaluate(forecaster, cv, y[, X, strategy, ...])

Evaluate forecaster using timeseries cross-validation.

Time index splitters#

Evaluation and tuning can be customized using time index based splitters, for a list of these consult the splitter API