
k-nearest neighbors
K-nearest neighbors (KNN) is a simple machine learning method used to classify or predict data points based on their similarity to nearby examples. When given a new data point, KNN looks at its closest neighbors in the dataset—those most similar or close in terms of features—and uses their known outcomes to determine the new point’s category or value. Essentially, it assumes that points close to each other in the data tend to be alike, enabling it to make decisions based on local patterns without building a complex model.