I'm working on time series in the scope of similarity detection at the moment. What seems to be a well researched approach is dynamic time warping in combination with k-1NN as classification algorithmn.

If I am right, the Dynamic Time Warping Distance is used to calculate the distance between two/a set of series. Afterwards k-1NN is applied. K-1NN takes the distance and returns for every time series the closest series.

Another approach is to cluster the series using their pair wise distance as input for an hierarchical clustering algorithm.

It seems to me, that both HAC and k-1NN are doing the exact same thing. Both are suited for unlabeld data and can return the closest point of the data set.

Am I missing something and the link between them is so obvious, that nobody wrote that simply down?

Best regards!


1 Answer 1


No, they are not the same.

  • kNN classification needs labeled data, and returns the label of the nearest neighbor
  • hierarchical clustering does not stop at finding the nearest neighbors. It merges them into a cluster and repeats this n-1 times to get a hierarchy, then tries to extract a meaningful partitioning from this hierarchy. These last steps are where it becomes interesting

They actually have little in common besides using similarity search at some point. But a lot of tasks involve similarities...

  • $\begingroup$ Thanks for your response! I'm aware of the need for labeled data for kNN in general. But for the unsupervised k = 1, all the algorithmn do, is to return the closest point, which I read here in the first answer. [link] (datascience.stackexchange.com/questions/34073/…) .I can't see the difference to hierarchical clustering there. I should probably just get some test data and see what will happen if compared directly. $\endgroup$
    – nail
    Jul 5, 2019 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.