# tsfresh — Automatic Time Series Feature Extraction > A Python package that automatically calculates and filters hundreds of time series features for use in classification and regression tasks with scikit-learn. ## Install Save in your project root: # tsfresh — Automatic Time Series Feature Extraction ## Quick Use ```bash pip install tsfresh ``` ```python from tsfresh import extract_features from tsfresh.examples.robot_execution_failures import load_robot_execution_failures timeseries, y = load_robot_execution_failures() features = extract_features(timeseries, column_id="id", column_sort="time") ``` ## 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 tsfresh` or `conda install -c conda-forge tsfresh` - Control feature sets via `ComprehensiveFCParameters`, `MinimalFCParameters`, or `EfficientFCParameters` - Set `n_jobs` parameter to control parallelism during extraction - Use `default_fc_parameters` to define custom feature calculator subsets - Integrate into scikit-learn pipelines with `TSFreshFeatureExtractor` transformer ## 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. ## Sources - https://github.com/blue-yonder/tsfresh - https://tsfresh.readthedocs.io/ --- Source: https://tokrepo.com/en/workflows/asset-b510839a Author: AI Open Source