Showing posts from December, 2012

Introduction to the K-Nearest Neighbor (KNN) algorithm

In pattern recognition, the K-Nearest Neighbor algorithm (KNN) is a method for classifying objects based on the closest training examples in the feature space.  KNN is a type of instance-based learning, or lazy learning where the function is only approximated locally and all computation is deferred until classification.  The KNN algorithm is amongst the simplest of all machine learning algorithms: an object is classified by a majority vote of its neighbors, with the object being assigned to the class most common amongst its k nearest neighbors (k is a positive integer, typically small).  If k = 1, then the object is simply assigned to the class of its nearest neighbor [Source: Wikipedia].
In today's post, we explore the application of KNN to an automobile manufacturer that has developed prototypes for two new vehicles, a car and a truck.  Before introducing the new models into its range, the manufacturer wants to determine which of the existing models in the marketplace are most l…