sktime

On this page 7

sktime is an open-source Python framework for machine learning with time series that offers a unified, scikit-learn compatible interface for forecasting, time series classification, regression, clustering, detection and transformations. In time series & forecasting work, it lets practitioners swap, compose and tune models through one consistent API instead of learning a different interface for every statistical or machine learning package.

The project began around 2019 in an academic setting in the United Kingdom and is now maintained by an independent community under a permissive BSD-3 license. Its design goal is not to reimplement every algorithm but to provide a common layer of estimators, pipelines and evaluation tools that also wraps libraries such as statsmodels, pmdarima and statsforecast.

How sktime structures time series learning

sktime organizes functionality around task-specific estimator types, each with a defined interface. A forecaster is fitted on past values with fit and returns future values with predict, while the forecasting horizon states which future steps are needed, either relative to the cutoff or as absolute time points.

Every estimator carries tags that describe its capabilities, for example whether it supports exogenous covariates, missing values, multivariate input or probabilistic output. The framework uses these tags to check inputs and convert data formats automatically, so the same forecaster can accept a pandas Series, a DataFrame or a hierarchical MultiIndex frame.

The table lists the main learning tasks and the base interface each one exposes.

TaskBase estimator typeTypical output
ForecastingForecasterFuture values, intervals or quantiles
Time series classificationClassifierClass label per series
Time series regressionRegressorNumeric value per series
ClusteringClustererCluster assignment per series
Detection and segmentationDetectorAnomalies, change points or segments
TransformationTransformerChanged series or extracted features
Learning tasks covered by sktime

Key building blocks for forecasting

The forecasting module is the most widely used part of sktime, and its strength lies in composition. Simple forecasters can be combined with transformers, reduction wrappers and tuning objects to build complex models that still behave like a single estimator with fit and predict.

The table describes the components that appear most often in forecasting code.

ComponentPurposeExample use
ForecastingHorizonDefines the steps to predictSteps 1 to 12 for a monthly year ahead
Reduction wrapperTurns a tabular regressor into a forecasterGradient boosting with lag features
TransformedTargetForecasterChains transformations on the targetDeseasonalize, detrend, then forecast
ForecastingPipelineTransforms exogenous covariatesScaling or imputing external drivers
Temporal splittersCreate expanding or sliding windowsBacktesting over rolling origins
ForecastingGridSearchCVTunes hyperparameters with temporal splitsChoosing a seasonal period or lag count
Core forecasting components

Reduction deserves attention because it links classical machine learning with forecasting. sktime can apply a regressor through a recursive or direct forecasting strategy, and the choice affects error accumulation over long horizons.

sktime compared with other forecasting libraries

sktime is a general-purpose framework rather than a single-model package, which shapes where it fits best. Specialized libraries often provide faster implementations of one family of models, while sktime focuses on interoperability, composition and evaluation across many families.

The comparison below places sktime among neighboring tools that practitioners often consider.

LibraryMain focusRelationship to sktime
sktimeUnified interface for many time series tasksFramework layer
statsmodelsStatistical models such as ARIMA and ETSWrapped as sktime forecasters
statsforecastFast statistical forecasting at scalePartly interfaced through adapters
ProphetAdditive trend and seasonality modelAvailable through an adapter
GluonTSProbabilistic deep learning forecastersSeparate ecosystem with its own API
DartsForecasting with classical and neural modelsSimilar goal, different interface design
sktime and related Python libraries

Evaluation and probabilistic forecasting in sktime

sktime provides time series cross-validation through splitters and an evaluate function that refits or updates the model at each cutoff. This rolling-origin backtesting avoids the leakage that a random train-test split would cause in temporal data.

Built-in metrics include MAE, MAPE, sMAPE and MASE, as well as probabilistic scores such as pinball loss and interval coverage. Forecasters that support it expose predict_interval, predict_quantiles and full distribution predictions, which allows probabilistic forecasting within the same workflow as point forecasts.

For grouped data, sktime handles hierarchical and panel series through pandas MultiIndex frames. A forecaster can be fitted per series automatically, and reconciliation transformers align forecasts so that lower levels add up to the totals above them.

In production, forecasters also support an update method that ingests new observations and moves the cutoff forward without a full refit. This mirrors how forecasts are used operationally, where a model is retrained on a schedule but refreshed with each new data point. Backtests can emulate either behavior, and the choice should match the planned deployment so that measured accuracy reflects real use.

Practical choices, limitations and common mistakes

sktime is most useful when a team needs to compare many model families under one evaluation protocol. It is less suited to training large deep learning forecasters on millions of series, where specialized frameworks with GPU pipelines are usually faster.

The following table lists frequent problems and how to avoid them.

MistakeConsequenceFix
Index without a frequencyHorizon conversion errorsSet a regular DatetimeIndex or PeriodIndex
Random cross-validationLeakage and optimistic scoresUse expanding or sliding window splitters
Ignoring estimator tagsUnsupported input errorsCheck tags before composing models
Exogenous data missing at predictPrediction failureSupply future covariates for the horizon
Unpinned dependenciesChanged behavior after upgradesPin sktime and soft dependency versions
Common sktime mistakes and fixes

Because many estimators rely on optional soft dependencies, installation size and compatibility vary with the models a project uses. Teams should install only the extras they need and test upgrades in a separate environment.

A further misconception is that a unified interface makes models interchangeable in quality. sktime standardizes how models are called, not how well they suit the data, so baselines such as the naive forecast remain essential reference points.

A plain-language summary

sktime is a toolbox for data that changes over time, such as daily sales or hourly temperatures. Many forecasting tools exist, and each one works a little differently. sktime puts them behind one common set of buttons.

You train a model the same way each time. You ask for predictions the same way each time. This makes it easy to try several methods and keep the best one. It also helps you test them fairly, by always predicting the future from the past.

An example from practice

A data team at a regional grocery chain needs weekly demand forecasts for about 800 products across 40 stores. The analysts want to compare a seasonal naive baseline, an ETS model, an ARIMA model and a gradient boosting model built on lag features.

Using sktime, they store the data as a hierarchical frame indexed by store, product and week. They wrap the gradient boosting regressor with a reduction wrapper, add a deseasonalizing step in a TransformedTargetForecaster and run expanding-window backtests over the last 52 weeks. All four candidates use the same splitter and the same MASE metric.

The comparison shows that ETS wins for slow-moving items, while the boosting model performs best for promoted products. The team selects different models per product group and applies reconciliation so store totals match chain totals. Forecast error on the backtest falls noticeably compared with the previous spreadsheet method.