Introduction
tsfresh (Time Series Feature extraction based on Scalable Hypothesis tests) is a Python library that automates the process of extracting meaningful features from time series data. It computes hundreds of statistical characteristics and uses statistical hypothesis testing to select only the features relevant to your prediction target, bridging the gap between raw time series and tabular machine learning.
What tsfresh Does
- Extracts 794+ time series features including statistical, spectral, and entropy measures
- Applies automated feature selection using Benjamini-Hochberg hypothesis testing
- Integrates with pandas DataFrames and scikit-learn pipelines
- Supports parallel computation for large-scale feature extraction
- Handles panel data with multiple time series instances
Architecture Overview
tsfresh operates in two phases. First, the extraction phase computes a comprehensive set of features by applying calculators (simple, combiner, and custom) to each time series instance. Second, the selection phase evaluates each feature's relevance to the target variable using statistical tests (Mann-Whitney U, Kolmogorov-Smirnov, etc.) and filters irrelevant ones via the Benjamini-Yekutieli procedure. The distributed computation backend uses Python's multiprocessing or Dask.
Self-Hosting & Configuration
- Install with
pip install tsfreshorconda install -c conda-forge tsfresh - Control feature sets via
ComprehensiveFCParameters,MinimalFCParameters, orEfficientFCParameters - Set
n_jobsparameter to control parallelism during extraction - Use
default_fc_parametersto define custom feature calculator subsets - Integrate into scikit-learn pipelines with
TSFreshFeatureExtractortransformer
Key Features
- Largest open-source time series feature calculator library (794+ features)
- Statistical relevance filtering removes noise features automatically
- Scikit-learn-compatible transformer for pipeline integration
- Supports distributed computation for scalable extraction
- Well-tested feature calculators with comprehensive documentation
Comparison with Similar Tools
- sktime — Full ML framework; tsfresh specializes in feature extraction only
- TSFEL — Smaller feature set; tsfresh provides more comprehensive coverage and built-in selection
- Catch22 — 22 canonical features for speed; tsfresh trades speed for thoroughness
- Featuretools — General automated feature engineering; tsfresh is time series-specific
FAQ
Q: How long does feature extraction take?
A: It depends on data size and feature set. Use EfficientFCParameters for faster extraction with fewer features, or enable parallel processing with n_jobs.
Q: Can I add custom feature calculators?
A: Yes. Define a function with the @set_property decorator and include it in your feature calculation settings dictionary.
Q: Does tsfresh work with irregularly sampled data? A: tsfresh expects a sort column for ordering but does not require uniform spacing. However, some features assume regular sampling.
Q: What license is tsfresh released under? A: tsfresh uses the MIT license.