How is KNN different from k-Means?

  • Both algorithms coincidentally have the same k letter, but they are very different.
  • KNN — K nearest neighbor — supervised algorithm (classification/regression), k-Means — unsupervised algorithm (clustering)
  • Both use distance measurements but KNN needs labeled data whereas k-Means requires no data only a threshold on how many clusters we want to group the data into
  • In KNN, each unlabeled data point is marked with the majority label of the k nearest data points. In k-Means, data points are grouped to into their nearest centroids.
KNN uses training data to make predictions
K-Means group unlabeled data into given number of clusters

--

--

AI/Data Science Digest

One Digest At a Time. I value your time! #datascience #AI #GenAI #LLMs #dataanalyst #datascientist #probability #statistics #ML #savetime #digest