k-Nearest Neighbors

k-Nearest Neighbors (k-NN) is a simple, instance-based learning algorithm used for classification and regression tasks. It works by finding the k training instances that are closest to a new input instance and making a prediction based on the majority vote (for classification) or average (for regression) of the labels of the k nearest neighbors.