An open-source Python library that offers functions (a.k.a. distance measures) to compute the distance between time series. Distance measures in this library are suitable metrics for various time series machine learning tasks, including classification, clustering, motif discovery, similarity search, and more.
For details, please see the documentation.
from PyPi: python -m pip install tsdistance
This is alpha software with known Issues
to be fixed, so use it with caution. Please provide feedback by openning Issues
as they guide the developers on what to work on.
>>> from tsdistance.elastic import lcss
>>> import numpy as np
>>> X = np.array([3, 4, 38, 4, 5])
>>> Y = np.array([0, 3, 4])
>>> lcss_dist = lcss(X, Y, epsilon = 0.7)
>>> lcss_dist
>>> 0.33333333333333337
>>> from tsdistance import OneNN
>>> model = OneNN(metric = 'lcss')
>>> model.fit(Coffee_train_X, Coffee_train_y)
>>> predicted_label = model.predict(Coffee_test_X)
>>> print('predicted_label: ', predicted_label)
>>> lb_predict: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
Elastic Measures
Lockstep Measures
Sliding Measures
Kernel Measures
Multivariate Distance Measures