Could we achieve similar grouping or results for a set of data, if applied with either Knn and k-means
-
$\begingroup$ Certainly we can, if the groups are separated sufficiently well. What is your question? $\endgroup$– Stephan KolassaCommented Sep 30, 2020 at 21:12
-
$\begingroup$ Its more a conceptual question I was trying to answer for myself, however I agree with you, as I felt if the groups are well separated, where for k means the farthest distance it will cluster should also be equal to the farthest point the knn will neighbor as ; additionally the number of centroid in k means should be similar to number of possible classes! But I am kind of throwing ideas in the air and do not have anything concrete! $\endgroup$– blackmamba591Commented Sep 30, 2020 at 21:25
2 Answers
It's not sufficient that the $k$-NN and $k$-means both find strong signals.
Let us imagine data on a large number of cats and dogs owned by single-person households. We could measure many variables on the pets -- size, appearance, genetics -- and we would expect $k$-means to give a very clear 2-cluster solution with dogs in one cluster and cats in the other.
But we were actually interested in differences between pets owned by men and women. You could imagine (or at least I could) that $k$-NN could do pretty well at predicting the gender of owners from information about the pet, but that the $k$-NN classification would cut across the original $k$-means clusters.
Technically, you could achieve exactly same result by coin tossing as with classification algorithm, it would be hardly unlikely, though possible. More seriously, $k$-means is a clustering algorithm, so unsupervised learning, while $k$-NN is a classification, so supervised algorithm. Unless the labels in your data are about something unrelated to rest of the data, you could expect that there are some similarities between samples with same labels, hence that clustering algorithm can, but does not have to, group those observations together in a cluster, or clusters. However since $k$-means does absolutely nothing to match the labels, you do not have any guarantees that it will find clusters related to the labels.