0

I have a timeseries(temperature of a sensor)and I want to apply an unsupervised clustering that. I've already done that using sklearn library and Kmeans. but the problem is that I don't know how to add DTW as a metric. I need to compare timeseries using DTW and I have no idea how to do that.

Also as I saw in this link Kmeans can not perform very well on some kind of data, some methods like OPTICS and DBSCAN may be perform better on different type of data but the problem is that I tried them and they don't have predict function like kmeans. is there a better method for my problem?

  • The term is clustering, which is unsupervised as opposed to classification. I'm not sure if it's possible to use a custom distance with k-means, but it's possible with [agglomerative clustering](https://scikit-learn.org/stable/modules/generated/sklearn.cluster.AgglomerativeClustering.html#sklearn.cluster.AgglomerativeClustering). You would need to use `affinity=precomputed` and provide the distance matrix to `predict`. – Erwan Nov 01 '21 at 17:20
  • @Erwan Thank you I edited my question(classification to clustering). My problem with such algorithms like agglomerative clustering is they don't have a predict function, so if I face new data, I have to apply clustering on all the data again including my new data and it's really time consuming for me(about some minutes witch is too much in my case) – Soroosh Moghimi Nov 01 '21 at 20:20
  • You're right, with agglomerative clustering it's not possble to predict on new data. It's an interesting question, I hope somebody can give you an answer. – Erwan Nov 03 '21 at 10:46

0 Answers0