<Tr> <Td> <Ul> <Li> </Li> <Li> </Li> <Li> </Li> </Ul> </Td> </Tr> <Ul> <Li> </Li> <Li> </Li> <Li> </Li> </Ul> <P> In pattern recognition, the k - nearest neighbors algorithm (k - NN) is a non-parametric method used for classification and regression . In both cases, the input consists of the k closest training examples in the feature space . The output depends on whether k - NN is used for classification or regression: </P> <Dl> <Dd> <Ul> <Li> In k - NN classification, the output is a class membership . An object is classified by a majority vote of its neighbors, with the object being assigned to the class most common among its k nearest neighbors (k is a positive integer, typically small). If k = 1, then the object is simply assigned to the class of that single nearest neighbor . </Li> </Ul> </Dd> </Dl>

If k=1 then the algorithm is simply called the nearest neighbour algorithm