tslearn-team / tslearn

The machine learning toolkit for time series analysis in Python
https://tslearn.readthedocs.io
BSD 2-Clause "Simplified" License
2.89k stars 337 forks source link

Add LCSS as a distance metric in TimeSeriesKMeans #434

Open pushkar5586 opened 1 year ago

pushkar5586 commented 1 year ago

Hi,

Is there a plan to support Longest Common Subsequence (LCSS) as a distance/similarity metric in the TimeSeriesKMeans model?

Many thanks.

pushkar5586 commented 1 year ago

This page says:

"This is the algorithm at stake when invoking tslearn.clustering.TimeSeriesKMeans with metric="lcss""

but, upon instantiating an object of type tslearn.clustering.TimeSeriesKMeans with metric="lcss", I get an exception saying that the only supported metric values are "euclidean", "dtw" and "dtw-soft".

I looked into the code of tslearn.clustering.TimeSeriesKMeans and LCSS isn't supported in there.

Would appreciate if anyone could share a timeline for an upgraded version of tslear with LCSS supported in its clustering models.

AMDonati commented 11 months ago

Hello, I am following-up on this issue regarding the integration of 'lcss' metric in tslearn.clustering.TimeSeriesKMeans. I indeed found that this integration is mentioned in the tslearn documentation release, but has not been effectively integrated.

I think it will be a great addition, as partitioning clustering algorithms depends heavily on the distance metric used, and as LCSS has proved to be more performant on noisy time-series whose length can differ greatly.

Many thanks in advance for the answer regarding this issue,

Arabiteff commented 8 months ago

you can use the sktime TimeSeriesKMeans it supports the lcss metric https://www.sktime.net/en/stable/api_reference/auto_generated/sktime.clustering.k_means.TimeSeriesKMeans.html