# K means supervised or unsupervised

## What are the main differences between K-means and K-nearest neighbors?

These are completely different methods. The fact that they both have the letter K in their names is a coincidence.

K-means is a clustering algorithm that tries to divide a set of points into K sets (clusters) so that the points in each cluster are close to each other. It is not monitored as the points have no external classification.

K-Nearest Neighbors is a classification (or regression) algorithm that combines the classification of the K Nearest Points to determine the classification of a point. It is being monitored because you are trying to classify a point based on the known classification of other points.

As noted in their response from Bitwise, k-means is a clustering algorithm. When it comes to k-nearest neighbors (k-NN) the terminology is a bit unclear:

• in the context of classification, it is a classification algorithm as it is also given in the above answer

• Generally it is a problem , for which different solutions (algorithms) exist

In the first context, the term "k-NN classifier" can actually mean various underlying concrete algorithms that solve the k-NN problem, and the result of which is interpreted for the purpose of classification.

These are two different things, but you'll find it interesting that the k-mean algorithm is one of several possible methods for solving the k-NN problem (Marius Muja and David G. Lowe, “Almost Approximate Nearest Neighbors with Automatic Algorithm - Configuration ", in International Conference on Theory and Application of Computer Vision (VISAPP'09), 2009 PDF)

You can have a supervised k-means. You can create centroids (like in k-means) based on your labeled data. Nothing is stopping you. If you want to improve on this, Euclidean space and distance may not give the best results. You need to choose your space (e.g. Riemann space) and define the distance between points (and even define a "point"). The last two are research topics and also depend on the type (properties) of data (signal) you have.

K-means can create the cluster information for neighboring nodes, while KNN cannot find the cluster for a specific neighboring node.

k Means can be used as a training phase before knn is used in the actual classification phase. K means generates the classes which are represented by the center of gravity and the class name of the samples belonging to each class. knn uses these parameters as well as the k-number to classify an invisible new sample and one of the k- Assign classes created by the K-mean algorithm

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.