API Reference¶
This is the class and function reference for sktime
.
sktime.classification: Time series classification¶
The sktime.classification
module contains algorithms and composition tools for time series classification.
Composition¶

Applies estimators to columns of an array or pandas DataFrame. 
Dictionarybased¶

Single Bag of SFA Symbols (BOSS) classifier 

Bag of SFA Symbols (BOSS) 

Contractable Bag of SFA Symbols (cBOSS) implementation of BOSS from [1] with refinements described in [2] 

Word ExtrAction for time SEries cLassification (WEASEL) from [1]. 

WEASEL+MUSE (MUltivariate Symbolic Extension) MUSE: implementation of multivariate version of WEASEL, referred to as just MUSE from [1] 

Single TDE classifier, based off the Bag of SFA Symbols (BOSS) model 
Temporal Dictionary Ensemble (TDE) as described in [1]. 
Distancebased¶
An adapted version of the scikitlearn KNeighborsClassifier to work with time series data. 


The Elastic Ensemble (EE) as described in Jason Lines and Anthony Bagnall, “Time Series Classification with Ensembles of Elastic Distance Measures”, Data Mining and Knowledge Discovery, 29(3), 2015. 

Proximity Forest class to model a decision tree forest which uses distance measures to partition data, see [1]. 

Proximity Tree class to model a decision tree which uses distance measures to partition data. 

Proximity Stump class to model a decision stump which uses a distance measure to partition data. 
Hybrid¶

Hierarchical Vote Collective of Transformationbased Ensembles (HIVECOTE) V1 as described in [1]. 
Intervalbased¶

Random Interval Spectral Forest (RISE) from [1] 

Supervised Time Series Forest (STSF) classifier as described in [1]. 
Shapeletbased¶
Shapelet Transform Classifier 


Time Series Classification with multiple symbolic representations and SEQL (MrSEQL) 

Classifier wrapped for the ROCKET transformer using RidgeClassifierCV as the base classifier. 
sktime.regression: Time series regression¶
The sktime.regression
module contains algorithms and composition tools for time series regression.
Composition¶
TimeSeries Forest Regressor. 
Intervalbased¶

Time series forest regressor. 
sktime.series_as_features: Seriesasfeatures tools¶
The sktime.series_as_features
module contains algorithms and composition tools that are shared by the classification and regression modules.
Composition¶

Concatenates results of multiple transformer objects. This estimator applies a list of transformer objects in parallel to the input data, then concatenates the results. This is useful to combine several feature extraction mechanisms into a single transformer. Parameters of the transformations may be set using its name and the parameter name separated by a ‘__’. A transformer may be replaced entirely by setting the parameter with its name to another transformer, or removed by setting to ‘drop’ or 
Model selection¶

Crossvalidation iterator over split predefined in files. 

Helper class for orchestration that uses a single split for training and testing. 
sktime.forecasting: Time series forecasting¶
The sktime.forecasting
module contains algorithms and composition tools for forecasting.
Base¶

Forecasting horizon 
Naive¶

NaiveForecaster is a forecaster that makes forecasts using simple strategies. 
Trend¶

Forecast time series data with a polynomial trend. 
Exponential Smoothing¶

HoltWinters exponential smoothing forecaster. 

ETS models with both manual and automatic fitting capabilities. 
ARIMA¶

Automatically discover the optimal order for an ARIMA model. 

An ARIMA estimator. 
Theta¶

Theta method of forecasting. 
BATS/TBATS¶

BATS estimator used to fit and select best performing model. 

TBATS estimator used to fit and select best performing model. 
Prophet¶

Prophet forecaster by wrapping fbprophet. :param freq: https://pandas.pydata.org/pandasdocs/stable/user_guide/timeseries.html #timeseriesoffsetaliases :type freq: String of DatetimeIndex frequency. See here for possible values: :param add_seasonality: Dict can have the following keys/values: name: string name of the seasonality component. period: float number of days in one period. fourier_order: int number of Fourier components to use. prior_scale: optional float prior scale for this component. mode: optional ‘additive’ or ‘multiplicative’ condition_name: string name of the seasonality condition. :type add_seasonality: Dict with args for Prophet.add_seasonality(). :param add_country_holidays: Dict can have the following keys/values: country_name: Name of the country, like ‘UnitedStates’ or ‘US’ :type add_country_holidays: Dict with args for Prophet.add_country_holidays(). :param growth: trend. :type growth: String ‘linear’ or ‘logistic’ to specify a linear or logistic :param changepoints: not specified, potential changepoints are selected automatically. :type changepoints: List of dates at which to include potential changepoints. If :param n_changepoints: 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. :type n_changepoints: Number of potential changepoints to include. Not used :param changepoint_range: be estimated. Defaults to 0.8 for the first 80%. Not used if changepoints is specified. :type changepoint_range: Proportion of history in which trend changepoints will :param yearly_seasonality: Can be ‘auto’, True, False, or a number of Fourier terms to generate. :type yearly_seasonality: Fit yearly seasonality. :param weekly_seasonality: Can be ‘auto’, True, False, or a number of Fourier terms to generate. :type weekly_seasonality: Fit weekly seasonality. :param daily_seasonality: Can be ‘auto’, True, False, or a number of Fourier terms to generate. :type daily_seasonality: Fit daily seasonality. :param holidays: and optionally columns lower_window and upper_window which specify a range of days around the date to be included as holidays. lower_window=2 will include 2 days prior to the date as holidays. Also optionally can have a column prior_scale specifying the prior scale for that holiday. :type holidays: pd.DataFrame with columns holiday (string) and ds (date type) :param seasonality_mode: :type seasonality_mode: ‘additive’ (default) or ‘multiplicative’. :param seasonality_prior_scale: seasonality model. Larger values allow the model to fit larger seasonal fluctuations, smaller values dampen the seasonality. Can be specified for individual seasonalities using add_seasonality. :type seasonality_prior_scale: Parameter modulating the strength of the :param holidays_prior_scale: components model, unless overridden in the holidays input. :type holidays_prior_scale: Parameter modulating the strength of the holiday :param changepoint_prior_scale: automatic changepoint selection. Large values will allow many changepoints, small values will allow few changepoints. :type changepoint_prior_scale: Parameter modulating the flexibility of the :param mcmc_samples: with the specified number of MCMC samples. If 0, will do MAP estimation. :type mcmc_samples: Integer, if greater than 0, will do full Bayesian inference :param alpha: for the forecast. If mcmc_samples=0, this will be only the uncertainty in the trend using the MAP estimate of the extrapolated generative model. If mcmc.samples>0, this will be integrated over all model parameters, which will include uncertainty in seasonality. :type alpha: Float, width of the uncertainty intervals provided :param uncertainty_samples: uncertainty intervals. Settings this value to 0 or False will disable uncertainty estimation and speed up the calculation. :type uncertainty_samples: Number of simulated draws used to estimate :param stan_backend: iterate over all available backends and find the working one :type stan_backend: str as defined in StanBackendEnum default: None  will try to. 
Composition¶

Ensemble of forecasters 

Metaestimator for forecasting transformed time series. 

Forecasting based on reduction to tabular regression with a direct reduction strategy. 

Forecasting based on reduction to time series regression with a direct reduction strategy. 

Forecasting based on reduction to tabular regression with a multioutput reduction strategy. 

Forecasting based on reduction to tabular regression with a recursive reduction strategy. 
Forecasting based on reduction to time series regression with a recursive reduction strategy. 


Forecasting based on reduction 



Online Forecasting¶

Online Updating Ensemble of forecasters 

Implementation of A Parameterfree Hedging Algorithm, Kamalika Chaudhuri, Yoav Freund, Daniel Hsu (2009) as a hedgestyle algorithm. 

Ensemble class that performs a nonnegative least squares to fit to the estimators. 
Model Selection¶

Cutoff window splitter. 

Single window splitter. 

Sliding window splitter. 

Expanding window splitter. 

Performs gridsearch crossvalidation to find optimal model parameters. 

Performs randomizedsearch crossvalidation to find optimal model parameters. 

Split arrays or matrices into sequential train and test subsets Creates train/test splits over endogenous arrays an optional exogenous arrays. 
Model Evaluation¶

Evaluate forecaster using crossvalidation 
sktime.transformations: Time series transformers¶
The sktime.transformations
module contains classes for data
transformations.
Panel transformers¶
Dictionarybased¶

(PAA) Piecewise Aggregate Approximation Transformer, as described in Eamonn Keogh, Kaushik Chakrabarti, Michael Pazzani, and Sharad Mehrotra. 

SFA (Symbolic Fourier Approximation) Transformer, as described in 

SAX (Symbolic Aggregate approXimation) Transformer, as described in Jessica Lin, Eamonn Keogh, Li Wei and Stefano Lonardi, “Experiencing SAX: a novel symbolic representation of time series” Data Mining and Knowledge Discovery, 15(2):107144 Overview: for each series: run a sliding window across the series for each window shorten the series with PAA (Piecewise Approximate Aggregation) discretise the shortened series into fixed bins form a word from these discrete values by default SAX produces a single word per series (window_size=0). SAX returns a pandas data frame where column 0 is the histogram (sparse pd.series) of each series. 
Summarize¶

Transformer that finds segments of the same given value, plateau in the time series, and returns the starting indices and lengths. 
Transformer that segments timeseries into random intervals and subsequently extracts seriestoprimitives features from each interval. 


Extract parameters of a fitted forecaster as features for a subsequent tabular learning task. 
tsfresh¶
Transformer for extracting and selecting features. 

Transformer for extracting time series features 
Catch22¶

Canonical Timeseries Characteristics (catch22) 
Compose¶

Applies transformations to columns of an array or pandas DataFrame. 
Transformer that concatenates multivariate time series/panel data into long univariate time series/panel data by simply concatenating times series in time. 





Factory function for creating InstanceTransformer based on transform type 
Matrix profile¶

Takes as input a time series dataset and returns the matrix profile and index profile for each time series of the dataset. 
PCA¶

Transformer that applies Principle Components Analysis to a univariate time series. 
Reduce¶
A transformer that turns time series/panel data into tabular data. 
Rocket¶

ROCKET 

MINIROCKET 

MINIROCKET (Multivariate) 
Segment¶

Interval segmentation transformer. 

Transformer that segments timeseries into random intervals with random starting points and lengths. 
Shapelet¶

Shapelet Transform. 
Contracted Shapelet Transform. @incollection{bostrom2017binary, title={Binary shapelet transform for multiclass time series classification}, author={Bostrom, Aaron and Bagnall, Anthony}, booktitle={Transactions on LargeScale Dataand KnowledgeCentered Systems XXXII}, pages={24–46}, year={2017}, publisher={Springer} }. 
Series transformers¶
Detrend¶

Remove a trend from a series. 

A transformer that removes seasonal components from time series 
A transformer that removes seasonal components from time series, conditional on seasonality test. 
Adapt¶

Adaptor for scikitlearnlike tabular transformations to series setting. 
Boxcox¶


Autocorrelation¶

Autocorrelation transformer. 

Partial autocorrelation transformer. 
Cosine¶
Matrix Profile¶

Imputer¶

Missing value imputation 
HampelFilter¶

HampelFilter to detect outliers based on a sliding window. 
OptionalPassthrough¶

A transformer to tune the implicit hyperparameter whether or not to use a particular transformer inside a pipeline (e.g. 
sktime.datasets: Datasets¶
Load the airline univariate time series dataset [1]. 


Loads the ArrowHead time series classification problem and returns X and y. 

Loads the GunPoint time series classification problem and returns X and y :param split: Whether to load the train or test partition of the problem. By default it loads both. :type split: None or str{“train”, “test”}, optional (default=None) :param return_X_y: If True, returns (features, target) separately instead of a single dataframe with columns for features and the target. :type return_X_y: bool, optional (default=False). 

Loads the OSULeaf time series classification problem and returns X and y 

Loads the ItalyPowerDemand time series classification problem and returns X and y 

Loads the BasicMotions time series classification problem and returns X and y. 

Loads the JapaneseVowels time series classification problem and returns X and y. 
Load the shampoo sales univariate time series dataset for forecasting. 


Load the Longley multivariate time series dataset for forecasting with exogenous variables. 
Load the lynx univariate time series dataset for forecasting. 


Loads the power consumption of typical appliances time series classification problem and returns X and y. 

Load the multivariate time series dataset for forecasting Growth rates of personal consumption and personal income. 

Load dataset from UCR UEA time series classification repository. 
sktime.utils: Utility function¶
The sktime.utils
module contains utility functions.
Plotting¶

Plot one or more time series 
Data Processing¶
Checks whether any cells have nested structure in each DataFrame column. 

Checks whether the input is a nested DataFrame. 


Convert nested pandas DataFrame or Series with NumPy arrays or pandas Series in cells into tabular pandas DataFrame with primitives in cells, i.e. a data frame with the same number of rows as the input data and as many columns as there are observations in the nested series. 

Convert tabular pandas DataFrame with only primitives in cells into nested pandas DataFrame with a single column. 
Converts 3d NumPy array (n_instances, n_columns, n_timepoints) to a 2d NumPy array with shape (n_instances, n_columns*n_timepoints) 


Convert NumPy ndarray with shape (n_instances, n_columns, n_timepoints) into nested pandas DataFrame (with time series as pandas Series in cells) 
Convert nested pandas DataFrame (with time series as pandas Series in cells) into NumPy ndarray with shape (n_instances, n_columns, n_timepoints). 


Convert panel data stored as pandas multiindex DataFrame to Numpy 3dimensional NumPy array (n_instances, n_columns, n_timepoints). 

Convert 3dimensional NumPy array (n_instances, n_columns, n_timepoints) to panel data stored as pandas multiindexed DataFrame. 

Converts a pandas DataFrame witha multiindex to a nested DataFrame 

Converts nested pandas DataFrame (with time series as pandas Series or NumPy array in cells) into multiindexed pandas DataFrame. 

Convert nested DataFrame to long DataFrame. 

Convert long DataFrame to a nested DataFrame. 