sktime-tsfresh

Time series machine learning layer (Tier 1): integration of **sktime** and **tsfresh** for building production-grade pipelines that transform raw time series into tabular feature representations suitable for classical machine-learning models. *sktime* provides a unified, sklearn-compatible interface for time-series data types, transformations, and pipelines, while *tsfresh* enables large-scale automated extraction of statistical, spectral, and autocorrelation features, with optional statistically grounded feature relevance selection (FRESH).

9 stars

Best use case

sktime-tsfresh is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Time series machine learning layer (Tier 1): integration of **sktime** and **tsfresh** for building production-grade pipelines that transform raw time series into tabular feature representations suitable for classical machine-learning models. *sktime* provides a unified, sklearn-compatible interface for time-series data types, transformations, and pipelines, while *tsfresh* enables large-scale automated extraction of statistical, spectral, and autocorrelation features, with optional statistically grounded feature relevance selection (FRESH).

Teams using sktime-tsfresh should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/sktime & tsfresh/SKILL.md --create-dirs "https://raw.githubusercontent.com/tondevrel/scientific-agent-skills/main/skills/sktime & tsfresh/SKILL.MD"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/sktime & tsfresh/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How sktime-tsfresh Compares

Feature / Agentsktime-tsfreshStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Time series machine learning layer (Tier 1): integration of **sktime** and **tsfresh** for building production-grade pipelines that transform raw time series into tabular feature representations suitable for classical machine-learning models. *sktime* provides a unified, sklearn-compatible interface for time-series data types, transformations, and pipelines, while *tsfresh* enables large-scale automated extraction of statistical, spectral, and autocorrelation features, with optional statistically grounded feature relevance selection (FRESH).

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

---

name: sktime-tsfresh
description: Time series machine learning layer (Tier 1): integration of **sktime** and **tsfresh** for building production-grade pipelines that transform raw time series into tabular feature representations suitable for classical machine-learning models. *sktime* provides a unified, sklearn-compatible interface for time-series data types, transformations, and pipelines, while *tsfresh* enables large-scale automated extraction of statistical, spectral, and autocorrelation features, with optional statistically grounded feature relevance selection (FRESH).
Use when: converting time series into tabular features for any sklearn-compatible estimator; interpretability of features is important; many series/sensors must be processed consistently; automated feature generation is preferred over manual engineering; multiple feature sources (e.g., tsfresh + rolling/lag features) must be combined in a single leakage-safe pipeline.
Do not use as a default end-to-end forecasting solution: for pure forecasting tasks, sktime forecasters are often more appropriate. tsfresh is primarily a **feature-extraction and reduction layer**, not a forecasting model.
version: sktime 0.40.x; tsfresh 0.21.x
license: sktime BSD-3-Clause; tsfresh MIT
-----------------------------------------

# sktime + tsfresh — Time Series Feature Extraction Layer

This layer addresses a central applied problem in time-series machine learning: **how to transform raw temporal data into informative, reproducible, and leakage-free tabular features suitable for downstream learning algorithms**.

* **sktime** supplies standardized time-series data containers (Series, Panel, Hierarchical), transformation APIs, and pipeline composition compatible with the sklearn ecosystem.
* **tsfresh** provides automated extraction of a comprehensive set of descriptive features from time series, together with statistically motivated relevance filtering.
* sktime offers native wrappers (`TSFreshFeatureExtractor`, `TSFreshRelevantFeatureExtractor`) that integrate tsfresh seamlessly into sktime pipelines.

## Conceptual Model

```
TIME SERIES DATA
        ↓
FEATURE EXTRACTION (tsfresh via sktime)
        ↓
OPTIONAL FEATURE SELECTION (FRESH)
        ↓
TABULAR ML MODEL (sklearn-compatible)
```

All steps are embedded in a single pipeline so that feature extraction and selection are performed **only on training folds** during cross-validation, preventing information leakage.

## Data Representation

sktime operates with abstract *scitypes* (Series, Panel, Hierarchical) and multiple concrete representations.
For feature extraction, the most common format is a **nested pandas DataFrame (Panel)**:

* Rows correspond to instances (e.g., subjects, devices).
* Columns correspond to channels or variables.
* Each cell contains a univariate time series (e.g., `pd.Series` or `np.ndarray`).

Correct data representation is essential; many practical issues arise from mismatched scitypes rather than from modeling choices.

## Core Components

* **`TSFreshFeatureExtractor`**
  Performs automated feature extraction using tsfresh within a sktime transformer interface.

* **`TSFreshRelevantFeatureExtractor`**
  Extends extraction with relevance filtering based on the FRESH algorithm, reducing dimensionality while retaining informative features.

* **Pipeline composition**
  sktime pipelines and `FeatureUnion` enable sequential and parallel composition of multiple transformers and estimators.

## Canonical Pipeline Pattern

Below is a standard pattern for time-series classification using automated feature extraction:

```python
from sktime.transformations.panel.tsfresh import TSFreshFeatureExtractor
from sktime.pipeline import make_pipeline
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import StratifiedKFold, cross_val_score

tsfresh = TSFreshFeatureExtractor(
    default_fc_parameters="efficient",
    n_jobs=-1,
    disable_progressbar=True,
)

classifier = RandomForestClassifier(
    n_estimators=500,
    random_state=42,
    n_jobs=-1,
)

pipeline = make_pipeline(tsfresh, classifier)

cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)
scores = cross_val_score(pipeline, X, y, cv=cv, scoring="accuracy")
```

This formulation ensures that feature extraction occurs independently within each training fold.

## Feature Relevance Selection

High-dimensional feature spaces are common with tsfresh.
`TSFreshRelevantFeatureExtractor` integrates relevance testing directly into the pipeline:

```python
from sktime.transformations.panel.tsfresh import TSFreshRelevantFeatureExtractor
from sktime.pipeline import make_pipeline
from sklearn.linear_model import LogisticRegression

pipeline = make_pipeline(
    TSFreshRelevantFeatureExtractor(
        default_fc_parameters="efficient",
        n_jobs=-1,
        disable_progressbar=True,
    ),
    LogisticRegression(max_iter=2000),
)
```

This approach reduces overfitting risk and improves interpretability without violating cross-validation assumptions.

## Combining Multiple Feature Sources

sktime supports parallel feature extraction through `FeatureUnion`, enabling the combination of tsfresh features with domain-specific or alternative time-series representations (e.g., lagged statistics, ROCKET-style features):

```python
from sktime.transformations.compose import FeatureUnion
from sktime.pipeline import make_pipeline

features = FeatureUnion([
    ("tsfresh", TSFreshFeatureExtractor(default_fc_parameters="efficient", n_jobs=-1)),
    # ("custom", CustomTimeSeriesTransformer()),
])

pipeline = make_pipeline(features, RandomForestClassifier())
```

The resulting feature matrix concatenates outputs from all transformers in a leakage-safe manner.

## Practical Configuration Guidelines

### Feature Sets

* **`minimal`**: fast, diagnostic baseline.
* **`efficient`**: recommended default, balancing coverage and cost.
* **`comprehensive`**: exhaustive but computationally expensive; use only with sufficient resources.

### Performance

* Use `n_jobs=-1` for parallel computation.
* Adjust `chunksize` for large datasets to reduce scheduling overhead.
* Disable progress bars in automated or production environments.

### Missing Values

* Configure imputation functions when necessary; unhandled NaNs propagate into feature values and can destabilize downstream models.

## Best Practices

**Do**

* Perform feature extraction and selection inside pipelines.
* Validate models using time-aware or stratified cross-validation as appropriate.
* Monitor the number and distribution of generated features for stability and drift.

**Avoid**

* Extracting features on the full dataset before splitting.
* Starting directly with exhaustive feature sets without baseline evaluation.
* Ignoring data representation requirements.

## Scope and Limitations

This layer is best suited for **feature-based reduction of time series** for classical machine-learning models, especially when interpretability and modularity are priorities.
It is not intended as a universal solution for all forecasting problems, particularly those requiring end-to-end temporal modeling or strict real-time constraints.

Related Skills

xgboost-lightgbm

9
from tondevrel/scientific-agent-skills

Industry-standard gradient boosting libraries for tabular data and structured datasets. XGBoost and LightGBM excel at classification and regression tasks on tables, CSVs, and databases. Use when working with tabular machine learning, gradient boosting trees, Kaggle competitions, feature importance analysis, hyperparameter tuning, or when you need state-of-the-art performance on structured data.

xarray

9
from tondevrel/scientific-agent-skills

N-dimensional labeled arrays and datasets in Python. Built on top of NumPy and Dask. It introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays, making data analysis in physical sciences more intuitive and less error-prone. Use for working with multi-dimensional scientific data, NetCDF/GRIB/Zarr files, climate/weather/oceanographic datasets, remote sensing, geospatial imaging, large out-of-memory datasets with Dask, and labeled array operations.

transformers

9
from tondevrel/scientific-agent-skills

State-of-the-art Machine Learning for PyTorch, TensorFlow, and JAX. Provides thousands of pretrained models to perform tasks on different modalities such as text, vision, and audio. The industry standard for Large Language Models (LLMs) and foundation models in science.

tqdm

9
from tondevrel/scientific-agent-skills

A fast, extensible progress bar for Python and CLI. Instantly makes your loops show a smart progress meter with ETA, iterations per second, and customizable statistics. Minimal overhead. Use for monitoring long-running loops, simulations, data processing, ML training, file downloads, I/O operations, command-line tools, pandas operations, parallel tasks, and nested progress bars.

tensorflow

9
from tondevrel/scientific-agent-skills

Comprehensive deep learning framework for building, training, and deploying neural networks. TensorFlow provides tf.keras high-level API for model construction, tf.data for efficient data pipelines, and tf.function for graph-mode optimization. Use when working with: neural network training and inference, image classification/detection/segmentation, NLP/text processing with embeddings or transformers, time series forecasting, generative models (VAE, GAN), transfer learning with pretrained models, custom training loops with GradientTape, GPU/TPU accelerated computation, or any deep learning task.

sympy

9
from tondevrel/scientific-agent-skills

Comprehensive guide for SymPy - Python library for symbolic mathematics. Use for symbolic expressions, calculus (derivatives, integrals, limits, series), equation solving (algebraic, differential, systems), linear algebra, simplification, matrix operations, special functions, code generation, and mathematical proofs. Essential for analytical mathematics and computer algebra.

sunpy

9
from tondevrel/scientific-agent-skills

The community-developed free and open-source software package for solar physics. Provides tools for data search and download, coordinate transformations specific to solar physics, and powerful image processing through the Map object. Use when working with solar data, solar images (EUV, magnetograms, white light), solar coordinates (Helioprojective, Heliographic), Fido data search, solar time series, differential rotation, limb fitting, or multi-instrument solar analysis (AIA, HMI, GOES).

statsmodels

9
from tondevrel/scientific-agent-skills

Advanced statistical modeling and hypothesis testing. Complementary to SciPy's stats module, it provides classes and functions for the estimation of many different statistical models, as well as for conducting statistical tests and statistical data exploration. Use for linear regression, GLM, time series analysis, ANOVA, survival analysis, causal inference, and statistical hypothesis testing. Load when working with OLS, WLS, logistic regression, Poisson regression, ARIMA, SARIMAX, statistical diagnostics, p-values, confidence intervals, or R-style statistical analysis.

spacy-nltk

9
from tondevrel/scientific-agent-skills

Natural Language Processing for text analysis, corpus linguistics, and production NLP pipelines. spaCy provides fast production-grade tokenization, POS tagging, NER, dependency parsing, and custom model training. NLTK provides classical corpus linguistics, linguistic analysis, VADER sentiment, collocation analysis, and access to standard linguistic corpora. Use when: processing and analyzing text data, extracting named entities (people, orgs, locations, dates), dependency parsing and syntactic analysis, building text classification pipelines, performing corpus-level linguistic analysis (frequency, collocations, readability), sentiment analysis, lemmatization and stemming, working with multilingual text, training custom NER or text classifiers, or any task requiring structured understanding of natural language beyond simple string operations.

sklearn-explainability

9
from tondevrel/scientific-agent-skills

Advanced sub-skill for scikit-learn focused on model interpretability, feature importance, and diagnostic tools. Covers global and local explanations using built-in inspection tools and SHAP/LIME integrations.

sklearn-advanced

9
from tondevrel/scientific-agent-skills

Professional sub-skill for scikit-learn focused on robust pipeline architecture, custom estimator development, advanced feature engineering, and rigorous model validation. Covers Target Encoding, Nested Cross-Validation, and Production Deployment.

simpy

9
from tondevrel/scientific-agent-skills

A process-based discrete-event simulation framework. Use for modeling queuing systems, supply chains, manufacturing processes, network simulation, project management, and any system where events occur at specific points in time. Load when working with discrete event simulation, process modeling, resource allocation, virtual time, simpy.Environment, simpy.Resource, or event-driven simulation.