About Machine Learning ( Part 6: KNN vs. K-means )
In machine learning, K-Nearest Neighbors (KNN) and K-means Clustering are two commonly used algorithms. Despite their similar names, they serve different purposes and have distinct working principles.
KNN (K-Nearest Neighbors)
KNN is a supervised learning algorithm used for classification and regression tasks.
The core idea of KNN is:
Given a new data point, find the K most similar instances in the training dataset (neighbors) and use them to predict the output.
KNN is a lazy learning algorithm, meaning it does not require a training phase. Instead, it directly classifies or predicts based on stored data.