COR Brief
Data & Analytics

Tslearn

Tslearn is an open-source Python library designed for machine learning tasks on time series data. It extends popular scientific computing libraries such as scikit-learn, NumPy, and SciPy, providing specialized tools for preprocessing, clustering, classification, regression, and metric computations tailored to time series. The package supports variable-length time series and integrates seamlessly with scikit-learn APIs, enabling users to incorporate time series models into pipelines and perform hyper-parameter tuning. The library includes implementations of clustering algorithms like TimeSeriesKMeans and KShape, classification models such as KNNClassifier and TimeSeriesSVC, and metrics including Dynamic Time Warping and Global Alignment Kernel. Tslearn also offers data loaders for standard datasets like UCR and supports multiple computational backends including NumPy and Torch. It is distributed as free software under an open-source license.

Updated Jan 10, 2026open-source

Open-source Python package for machine learning on time series data with scikit-learn integration.

Pricing
open-source
Category
Data & Analytics
Company
Interactive PresentationOpen Fullscreen ↗
01
Provides clustering algorithms including TimeSeriesKMeans, KShape, and KernelKMeans for grouping time series data.
02
Includes models such as KNNClassifier, TimeSeriesSVC, LearningShapelets, and TimeSeriesSVR for supervised learning tasks on time series.
03
Supports distance and similarity metrics like Dynamic Time Warping and Global Alignment Kernel, as well as barycenter computations.
04
Offers preprocessing utilities including scaling and piecewise aggregation to prepare time series data for analysis.
05
Compatible with multiple backends such as NumPy and Torch, and integrates with scikit-learn pipelines for model building and tuning.

Time Series Clustering

Grouping variable-length time series data to identify patterns or clusters using TimeSeriesKMeans.

Time Series Classification

Classifying time series data with models like KNNClassifier or TimeSeriesSVC for predictive analytics.

Distance Metric Computation

Calculating similarity between time series using Dynamic Time Warping for tasks such as anomaly detection.

1
Install tslearn
Install via conda using 'conda install -c conda-forge tslearn' or pip with 'python -m pip install tslearn'.
2
Import and Load Data
Import tslearn modules and load time series data from sources like UCR datasets or NumPy arrays.
3
Select Backend
Optionally select computational backend using 'from tslearn.backend import instantiate_backend'.
4
Fit a Model
Create and fit a model, for example 'from tslearn.clustering import TimeSeriesKMeans; model = TimeSeriesKMeans(n_clusters=3).fit(X)'.
5
Predict or Analyze
Use the fitted model to predict or analyze data, e.g., 'labels = model.predict(X)'.
📊

Strategic Context for Tslearn

Get weekly analysis on market dynamics, competitive positioning, and implementation ROI frameworks with AI Intelligence briefings.

Try Intelligence Free →
7 days free · No credit card
Pricing
Model: open-source

Tslearn is free to use with no paid plans.

Assessment
Strengths
  • Follows scikit-learn API conventions for easy integration with existing machine learning workflows.
  • Supports variable-length time series without requiring padding.
  • Compatible with multiple computational backends including NumPy and Torch.
  • Includes specialized time series metrics such as Dynamic Time Warping.
  • Provides data loaders for standard datasets like UCR.
Limitations
  • Requires dependencies including scikit-learn, NumPy, SciPy, Numba, and joblib.
  • TensorFlow v2 is needed for specific modules like tslearn.neural.
  • Documentation emphasizes API reference over extensive tutorials.