I've read in several papers that K-nearest neighbor can be supervised or unsupervised learning. Is Knn always unsupervised when one use it for clustering and supervised when one used it for classification? I've to know if there is a unsupervised Knn in classification as well.

Thanks in advance! Phil

  • 3
    $\begingroup$ As far as I know K nearest neighbours is a supervised algorithm. What are your sources for it being used as an unsupervised algorithm? Are you sure you're not confusing it with K means? $\endgroup$ – Denziloe Aug 23 '18 at 21:45
  • $\begingroup$ cheuk yup ip et al refer to K nearest neighbor algorithm as unsupervised in a titled paper "automated learning of model classification" but most sources classify KNN as supervised ML technique. $\endgroup$ – AMINU LAWAL Nov 25 '18 at 20:15
  • $\begingroup$ It's obviously supervised since it takes labeled data as input. $\endgroup$ – Digio Feb 9 at 13:16

Assuming K is given, strictly speaking, KNN does not have any learning involved, i.e., there are no parameters we can tune to make the performance better. Or we are not trying to optimize an objective function from the training data set. This is a major differences from most supervised learning algorithms.

It is a rule that can be used in production time that can classify or clustering a instance based on its neighbors. Compute neighbors does not require label but label can be used to make the decision for the classification.

  • $\begingroup$ Interesting point of view -- I honestly do not know if there a canonically acceptable answer to this. But I do think that it fulfills the requirements of being an unsupervised learning program - as you add more data to it, the performance improves, indicating that there is some learning involved. Mathematically the information is saved as the connections between neighbours (and weights, where applicable). Since the number of connections grow superlinearly with number of vertices - there is definitely enough "memory" to effectively learn as new datapoints appear. Just IMO. $\endgroup$ – Debanjan Basu May 27 at 15:21

Your Answer

