tslearn
A machine learning toolkit dedicated to time-series data
Decision gist · record as of 2026-08-14
Yes. tslearn is actively maintained, has no known vulnerabilities, uses permissive licensing, and offers low installation friction. It fills a clear gap for time series machine learning with scikit-learn compatibility. Install if you need specialized time series algorithms; skip if your use case fits standard scikit-learn or you require production-grade time series forecasting.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >= 3.10
- Low friction: pure Python wheel with well-established dependencies (scikit-learn, numpy, scipy, numba, joblib, statsmodels).
- Active maintenance with last commit 2026-08-13 and release 43 days ago.
License · maintenance · safety
BSD-2-Clause (permissive) — BSD-2-Clause (permissive) allows commercial and private use with minimal restrictions; attribution required.
last release 2026-07-02 (43 days) · last repo commit 2026-08-13 · 3,168 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 313,462 downloads/mo, #7,714 on PyPI
Alternatives
Verify before relying
pip install tslearn
from tslearn.utils import to_time_series_dataset
from tslearn.neighbors import KNeighborsTimeSeriesClassifier
X = to_time_series_dataset([[1, 3, 4, 2], [1, 2, 4, 2]])
knn = KNeighborsTimeSeriesClassifier(n_neighbors=1)
knn.fit(X, [0, 1])- Whether numba JIT compilation is required for acceptable performance on large datasets
- Specific performance characteristics compared to alternative time series libraries
What it is and what it does
tslearn is a machine learning toolkit built on top of scikit-learn, numpy, scipy, and numba that specializes in time series data. It provides clustering (TimeSeriesKMeans), classification (KNeighborsTimeSeriesClassifier), regression, and distance metrics including Dynamic Time Warping. The package expects time series as 3D numpy arrays and handles variable-length sequences.
The library integrates seamlessly with scikit-learn's ecosystem, supporting pipelines and hyperparameter tuning. It includes utilities for data preprocessing (scaling, resampling, piecewise transformations), dataset loading (UCR datasets), and analysis tasks like computing barycenters. Models follow scikit-learn's fit/predict API, making it accessible to developers already familiar with that framework.
Use it for
- Classify time series sequences using k-nearest neighbors with time-aware distance metrics
- Cluster temporal data with TimeSeriesKMeans to find similar patterns across time series
- Measure similarity between time series using Dynamic Time Warping or other specialized metrics
- Preprocess variable-length time series with scaling and resampling before model training
- Build scikit-learn pipelines combining time series preprocessing and classification steps
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
tslearn is actively maintained, has no known vulnerabilities, uses permissive licensing, and offers low installation friction. It fills a clear gap for time series machine learning with scikit-learn compatibility. Install if you need specialized time series algorithms; skip if your use case fits standard scikit-learn or you require production-grade time series forecasting.
Install
tslearn on PyPI
Before you install
Low friction: pure Python wheel with well-established dependencies (scikit-learn, numpy, scipy, numba, joblib, statsmodels). Active maintenance with last commit 2026-08-13 and release 43 days ago.
Requires Python >= 3.10
License in practice
BSD-2-Clause (permissive) allows commercial and private use with minimal restrictions; attribution required.
Quickstart
pip install tslearn
from tslearn.utils import to_time_series_dataset
from tslearn.neighbors import KNeighborsTimeSeriesClassifier
X = to_time_series_dataset([[1, 3, 4, 2], [1, 2, 4, 2]])
knn = KNeighborsTimeSeriesClassifier(n_neighbors=1)
knn.fit(X, [0, 1])
Verify before relying
- Whether numba JIT compilation is required for acceptable performance on large datasets
- Specific performance characteristics compared to alternative time series libraries
Package facts
| License | BSD-2-Clause permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 6 packagesscikit-learnnumpyscipynumbajoblibstatsmodels |
| Maintenance | Actively maintained 43 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 313,462 / month, #7,714 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Software Development :: Libraries |
Evidence: tslearn-0.9.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “time series distance metrics”
- tslearntslearn provides machine learning algorithms optimized for time…
- dtaidistanceComputes distance measures between time series using Dynamic Time…
- pytsPyts provides time series classification algorithms and preprocessing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also dtaidistance · river · sktime · pyts · dtw-python · ai4ts · pypots · fairlearn · tsdb · tsdownsample