tslearn-team/tslearn

Custom metric on clustering

yasirroni opened this issue · 2 comments

Is your feature request related to a problem? Please describe.
I want to do some research by trying various custom metric on time series clustering. I already digging the docs and issues but can't find any tutorial on how to do that. This answer is partly answer the question.

Describe the solution you'd like
Maybe TimeSeriesKMeans could accept custom metric_type=custom and metric=funct? If it's already supported, how to do that?

Hi @yasirroni

I am afraid what you look for is not implemented at the moment.

As suggested in #180, if the metrics you want to compare are alignment metrics that differ on the features on which they rely, then this new feature request could be implemented by allowing custom DTW-like metrics in TimeSeriesKMeans. But for other similarity measures, there would be no easy way. Typically, what we need is:

  • to be able to compute the similarity between pairs of series
  • to be able to compute barycenters

We could maybe think of what would be the ideal API for this estimator to integrate this new behavior, if someone has time to work on that.

Hi @rtavenar, could you help by refer to me on the line of the code for:

  1. Distance metric evaluation for each time series to the centers?
  2. Barycenter computation.
  3. Centers update.
  4. Clusters members of each centers update.

If I could understand and got time, I might be able to help or someone read this issue might be interested.