Time series transformations#

The sktime.transformations module contains classes for data transformations.

All (simple) transformers in sktime can be listed using the sktime.registry.all_estimators utility, using estimator_types="transformer", optionally filtered by tags. Valid tags can be listed using sktime.registry.all_tags.

A full table with tag based search is also available on the Estimator Search Page (select “transformere” in the “Estimator type” dropdown).

For pairwise transformers (time series distances, kernels), instead see _transformations_pairwise_ref.

Transformations are categorized as follows:

Category

Explanation

Example

Composition

Building blocks for pipelines, wrappers, adapters

Transformer pipeline

Series-to-features

Transforms series to float/category vector

Length and mean

Series-to-series

Transforms individual series to series

Differencing, detrending

Series-to-Panel

transforms a series into a panel

Bootstrap, sliding window

Panel transform

Transforms panel to panel, not by-series

Padding to equal length

Hierarchical

uses hierarchy information non-trivially

Reconciliation

Composition#

Pipeline building - Structural#

TransformerPipeline(steps)

Pipeline of transformers compositor.

FeatureUnion(transformer_list[, n_jobs, ...])

Concatenates results of multiple transformer objects.

ColumnEnsembleTransformer(transformers[, ...])

Column-wise application of transformers.

FitInTransform(transformer[, ...])

Transformer wrapper to delay fit to the transform phase.

InvertTransform(transformer)

Invert a series-to-series transformation.

YtoX([subset_index])

Create exogeneous features which are a copy of the endogenous data.

IxToX([coerce_to_type, level, ix_source])

Create features based on time index or hierarchy values.

Pipeline building - Broadcasting and apply-map#

ColumnwiseTransformer(transformer[, columns])

Apply a transformer columnwise to multivariate series.

TransformByLevel(transformer[, groupby, ...])

Transform by instance or panel.

FunctionTransformer([func, inverse_func, ...])

Constructs a transformer from an arbitrary callable.

Pipeline building - AutoML, switches and multiplexing#

MultiplexTransformer(transformers[, ...])

Facilitate an AutoML based selection of the best transformer.

OptionalPassthrough(transformer[, passthrough])

Wrap an existing transformer to tune whether to include it in a pipeline.

TransformIf(if_estimator[, param, ...])

Conditional execution of a transformer given a condition from a fittable object.

Id()

Identity transformer, returns data unchanged in transform/inverse_transform.

Pipeline building - Logging#

Logger([logger, logger_backend, ...])

Logging transformer, writes data to logging, and otherwise leaves it unchanged.

Sklearn and pandas adapters#

Tabularizer()

A transformer that turns time series/panel data into tabular data.

TimeBinner(idx[, aggfunc])

Turns time series/panel data into tabular data based on intervals.

TabularToSeriesAdaptor(transformer[, ...])

Adapt scikit-learn transformation interface to time series setting.

PandasTransformAdaptor(method[, kwargs, ...])

Adapt pandas transformations to sktime interface.

Series-to-features transformers#

Series-to-features transformers transform individual time series to a collection of primitive features. Primitive features are usually a vector of floats, but can also be categorical.

When applied to panels or hierarchical data, the transformation result is a table with as many rows as time series in the collection.

Summarization#

These transformers extract simple summary features.

SummaryTransformer([summary_function, ...])

Calculate summary value of a time series.

WindowSummarizer([lag_feature, n_jobs, ...])

Transformer for extracting time series features.

SplitterSummarizer(transformer[, splitter, ...])

Create summary values of a time series' splits.

DerivativeSlopeTransformer()

Derivative slope transformer.

PlateauFinder([value, min_length])

Plateau finder transformer.

RandomIntervalFeatureExtractor([...])

Random interval feature extractor transform.

FittedParamExtractor(forecaster, param_names)

Fitted parameter extractor.

ADICVTransformer([features, adi_threshold, ...])

Transformer categorizing series into ADI-CV2 classes after Syntetos/Boylan.

Shapelets, wavelets, and convolution#

ShapeletTransform([min_shapelet_length, ...])

Shapelet Transform.

RandomShapeletTransform([...])

Random Shapelet Transform.

ShapeletTransformPyts([n_shapelets, ...])

Shapelet Transform, from pyts.

Rocket([num_kernels, normalise, n_jobs, ...])

RandOm Convolutional KErnel Transform (ROCKET).

MiniRocket([num_kernels, ...])

MINImally RandOm Convolutional KErnel Transform (MiniRocket).

MiniRocketMultivariate([num_kernels, ...])

MINImally RandOm Convolutional KErnel Transform (MiniRocket) multivariate.

MiniRocketMultivariateVariable([...])

MINIROCKET (Multivariate, unequal length).

DWTTransformer([num_levels])

Discrete Wavelet Transform Transformer.

Distance-based features#

MatrixProfile([m])

Return the matrix profile and index profile for each time series of a dataset.

Dictionary-based features#

SFA([word_length, alphabet_size, ...])

Symbolic Fourier Approximation (SFA) Transformer.

Auto-correlation-based features#

HurstExponentTransformer([lags, method, ...])

Transformer for calculating the Hurst exponent of a time series.

Moment-based features#

SignatureTransformer([augmentation_list, ...])

Transformation class from the signature method.

Feature collections#

These transformers extract larger collections of features.

TSFreshRelevantFeatureExtractor([...])

Transformer for extracting time series features via tsfresh.extract_features.

TSFreshFeatureExtractor([...])

Transformer for extracting time series features via tsfresh.extract_features.

Catch22([features, catch24, outlier_norm, ...])

Canonical Time-series Characteristics (Catch22).

Catch22Wrapper([features, catch24, ...])

Canonical Time-series Characteristics (Catch22 and 24), using pycatch22 package.

Series-to-series transformers#

Series-to-series transformers transform individual time series into another time series.

When applied to panels or hierarchical data, individual series are transformed.

Lagging#

Lag([lags, freq, index_out, ...])

Lagging transformer.

ReducerTransform([lags, freq, shifted_vars, ...])

Transformer for forecasting reduction.

Element-wise transforms#

These transformations apply a function element-wise.

Depending on the transformer, the transformation parameters can be fitted.

BoxCoxTransformer([bounds, method, sp, ...])

Box-Cox power transform.

LogTransformer([offset, scale])

Natural logarithm transformation.

ScaledLogitTransformer([lower_bound, ...])

Scaled logit transform or Log transform.

CosineTransformer()

Cosine transformation.

ExponentTransformer([power, offset])

Apply element-wise exponentiation transformation to a time series.

SqrtTransformer([offset])

Apply elementwise square root transformation to a time series.

ScaledAsinhTransformer([...])

Hyperbolic sine transformation and its inverse [Rf00c2e2051c3-1].

Detrending and Decomposition#

Detrender([forecaster, model])

Remove a trend from a series.

Deseasonalizer([sp, model])

Remove seasonal components from a time series.

ConditionalDeseasonalizer([...])

Remove seasonal components from time series, conditional on seasonality test.

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

Remove seasonal components from a time-series using STL.

MSTL(*[, periods, windows, lmbda, iterate, ...])

Season-Trend decomposition using LOESS for multiple seasonalities.

VmdTransformer([K, kMax, alpha, tau, DC, ...])

Variational Mode Decomposition transformer.

ClearSky([quantile_prob, bw_diurnal, ...])

Clear sky transformer for solar data.

Filtering and denoising#

Filter(sfreq[, l_freq, h_freq, filter_kwargs])

Transformer that filters Series data.

BKFilter([low, high, K])

Filter a times series using the Baxter-King filter.

CFFilter([low, high, drift])

Filter a times series using the Christiano Fitzgerald filter.

HPFilter([lamb])

Filter a times series using the Hodrick-Prescott filter.

KalmanFilterTransformerPK(state_dim[, ...])

Kalman Filter, from pykalman (sktime native maintenance fork).

KalmanFilterTransformerFP(state_dim[, ...])

Kalman Filter is used for denoising or inferring the hidden state of given data.

ThetaLinesTransformer([theta])

Decompose the original data into two or more Theta-lines.

Bollinger(window[, k, memory])

Apply Bollinger bands to a time series.

Differencing, slope, kinematics#

Differencer([lags, na_handling, memory])

Apply iterative differences to a timeseries.

SlopeTransformer([num_intervals])

Slope-by-segment transformation.

KinematicFeatures([features])

Kinematic feature transformer - velocity, acceleration, curvature.

Binning, sampling and segmentation#

TimeBinAggregate(bins[, aggfunc, return_index])

Bins time series and aggregates by bin.

TSInterpolator(length)

Time series interpolator/re-sampler.

IntervalSegmenter([intervals])

Interval segmentation transformer.

RandomIntervalSegmenter([n_intervals, ...])

Random interval segmenter transformer.

DilationMappingTransformer([dilation])

Dilation mapping transformer.

PAA([frames, frame_size])

Piecewise Aggregate Approximation Transformer (PAA).

SAX([word_size, alphabet_size, frame_size])

Symbolic Aggregate approXimation Transformer (SAX).

PAAlegacy([num_intervals])

Piecewise Aggregate Approximation Transformer (PAA).

SAXlegacy([word_length, alphabet_size, ...])

Symbolic Aggregate approXimation (SAX) transformer.

Missing value treatment#

Imputer([method, random_state, value, ...])

Missing value imputation.

DropNA([axis, how, thresh, remember])

Drop missing values transformation.

Seasonality and Date-Time Features#

DateTimeFeatures([ts_freq, feature_scope, ...])

DateTime feature extraction, e.g., for use as exogenous data in forecasting.

HolidayFeatures(calendar[, holiday_windows, ...])

Holiday features extraction.

CountryHolidaysTransformer(country[, ...])

Country Holidays Transformer.

FinancialHolidaysTransformer(market[, ...])

Financial Holidays Transformer.

TimeSince([start, to_numeric, freq, ...])

Compute element-wise time elapsed between time index and a reference start time.

FourierFeatures(sp_list, fourier_terms_list)

Fourier Features for time series seasonality.

FourierTransform()

Simple Fourier transform for time series.

PeakTimeFeature([ts_freq, peak_hour_start, ...])

PeakTime feature extraction for use in e.g. tree based models.

Auto-correlation series#

AutoCorrelationTransformer([adjusted, ...])

Auto-correlation transformer.

PartialAutoCorrelationTransformer([n_lags, ...])

Partial auto-correlation transformer.

Window-based series transforms#

These transformers create a series based on a sequence of sliding windows.

MatrixProfileTransformer([window_length])

Calculate the matrix profile of a time series.

HOG1DTransformer([num_intervals, num_bins, ...])

HOG1D transform.

SubsequenceExtractionTransformer(...[, ...])

Extract contiguous subsequences of specified length based on rolling aggregates.

Multivariate-to-univariate#

These transformers convert multivariate series to univariate.

ColumnConcatenator()

Concatenate multivariate series to a long univariate series.

Augmentation#

InvertAugmenter()

Augmenter inverting the time series by multiplying it by -1.

RandomSamplesAugmenter([n, ...])

Draw random samples from time series.

ReverseAugmenter()

Augmenter reversing the time series.

WhiteNoiseAugmenter([scale, random_state])

Augmenter adding Gaussian (i.e. white) noise to the time series.

FeatureSelection#

These transformers select features in X based on y.

FeatureSelection([method, n_columns, ...])

Select exogenous features.

ElbowClassSum([distance])

Elbow Class Sum (ECS) transformer to select a subset of channels/variables.

ElbowClassPairwise()

Elbow Class Pairwise (ECP) transformer to select a subset of channels.

Subsetting time points and variables#

These transformers subset X by time points (pandas index or index level) or variables (pandas columns).

ColumnSelect([columns, integer_treatment, ...])

Column selection transformer.

IndexSubset([index_treatment])

Index subsetting transformer.

Adapters to other frameworks#

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

TemporianTransformer(function[, compile])

Applies a Temporian function to the input time series.

Panel transformers#

Panel transformers transform a panel of time series into a panel of time series.

A panel transformer is fitted on an entire panel, and not per series.

Equal length transforms#

These transformations ensure all series in a panel have equal length

PaddingTransformer([pad_length, fill_value])

Padding panel of unequal length time series to equal, fixed length.

TruncationTransformer([lower, upper])

Truncates unequal length panels between lower/upper length ranges.

Dimension reduction#

PCATransformer([n_components, copy, whiten, ...])

Principal Components Analysis applied to panel of time series.

Series-to-Panel transformers#

These transformers create a panel from a single series.

Bootstrap transformations#

MovingBlockBootstrapTransformer([n_series, ...])

Moving Block Bootstrapping method for synthetic time series generation.

SplitterBootstrapTransformer([splitter, ...])

Splitter based Bootstrapping method for synthetic time series generation.

STLBootstrapTransformer([n_series, sp, ...])

Creates a population of similar time series.

Panel-to-Series transformers#

These transformers create a single series from a panel.

Merger([method, stride])

Aggregates Panel data containing overlapping windows of one time series.

Outlier detection, changepoint detection#

HampelFilter([window_length, n_sigma, k, ...])

Use HampelFilter to detect outliers based on a sliding window.

ClaSPTransformer([window_length, ...])

ClaSP (Classification Score Profile) Transformer.

Hierarchical transformers#

These transformers are specifically for hierarchical data and panel data.

The transformation depends on the specified hierarchy in a non-trivial way.

Aggregator([flatten_single_levels])

Prepare hierarchical data, including aggregate levels, from bottom level.

Reconciler([method])

Hierarchical reconciliation transformer.