Skip to content

A machine learning toolkit dedicated to time-series data

License

Notifications You must be signed in to change notification settings

MaxBenChrist/tslearn

 
 

Repository files navigation

PyPI version Documentation Status Build Status Code Climate Test Coverage

tslearn is a Python package that provides machine learning tools for the analysis of time series. This package builds on scikit-learn, numpy and scipy libraries.

If you would like to contribute to tslearn, please have a look at our contribution guidelines.

Dependencies

Cython
numpy
scipy
scikit-learn

If you plan to use the shapelets module, keras should also be installed.

Installation

Using PyPI

The easiest way to install tslearn is probably via pip:

pip install tslearn

Using latest github-hosted version

If you want to get tslearn's latest version, you can git clone the repository hosted at github:

git clone https://github.com/rtavenar/tslearn.git

Then, you should run the following command for Cython code to compile:

python setup.py build_ext --inplace

Also, for the whole package to run properly, its base directory should be appended to your Python path.

Documentation and API reference

The documentation, including a gallery of examples, is hosted at readthedocs.

Already available

  • A generators module provides Random Walks generators
  • A datasets module provides access to the famous UCR/UEA datasets through the UCR_UEA_datasets class
  • A preprocessing module provides standard time series scalers
  • A metrics module provides:
    • Dynamic Time Warping (DTW) (with Sakoe-Chiba band and Itakura parallelogram variants)
    • LB_Keogh
    • Global Alignment Kernel
    • Soft-DTW from Cuturi and Blondel
  • A neighbors module includes nearest neighbor algorithms to be used with time series
  • A clustering module includes the following time series clustering algorithms:
    • Standard Euclidean k-means (with adequate array reshaping done for you)
      • Based on tslearn.barycenters
    • DBA k-means from Petitjean et al.
      • Based on tslearn.barycenters that offers DBA facility that could be used for other applications than just k-means
    • Global Alignment kernel k-means
    • KShape clustering from Paparizzos and Gravano
    • Soft-DTW k-means from Cuturi and Blondel
      • Based on tslearn.barycenters that offers Soft-DTW barycenter computation
  • A shapelets module includes an efficient implementation of the Learning Time-Series method from Grabocka et al.
    • Warning: to use the shapelets module, an extra dependency is required: keras
  • A piecewise module includes standard time series transformations, as well as the corresponding distances:
    • Piecewise Aggregate Approximation (PAA)
    • Symbolic Aggregate approXimation (SAX)
    • 1d-Symbolic Aggregate approXimation (1d-SAX)

TODO list

Have a look there for a list of suggested features. If you want other ML methods for time series to be added to this TODO list, do not hesitate to open an issue! See our contribution guidelines for more information about how to proceed.

Acknowledgments

Authors would like to thank Mathieu Blondel for providing code for Kernel k-means and Soft-DTW (both distributed under BSD license) that is used in the clustering module of this library.

Referencing tslearn

If you use tslearn in a scientific publication, we would appreciate citations:

@misc{tslearn,
 title={tslearn: A machine learning toolkit dedicated to time-series data},
 author={Tavenard, Romain},
 year={2017},
 note={\url{https://github.com/rtavenar/tslearn}}
}

About

A machine learning toolkit dedicated to time-series data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 92.8%
  • Makefile 3.6%
  • Batchfile 3.6%