K-nearest neighbors algorithm: Difference between revisions

Content deleted Content added
KNN is used for classification AND regression (as stated below in the same paragraph) The term "Supervised Learning" covers both those concepts
capitalization typo
Line 2:
{{Distinguish|k-means clustering}}
{{DISPLAYTITLE:''k''-nearest neighbors algorithm}}
In [[statistics]], the '''''k''-nearest neighbors algorithm''' ('''''k''-NN''') is a [[Non-parametric statistics|non-parametric]] [[Supervisedsupervised learning]] method first developed by [[Evelyn Fix]] and [[Joseph Lawson Hodges Jr.|Joseph Hodges]] in 1951,<ref>{{Cite report | last1=Fix | first1=Evelyn | last2= Hodges | first2=Joseph L. | title=Discriminatory Analysis. Nonparametric Discrimination: Consistency Properties | issue=Report Number 4, Project Number 21-49-004 | year=1951 | url=https://apps.dtic.mil/dtic/tr/fulltext/u2/a800276.pdf | publisher=USAF School of Aviation Medicine, Randolph Field, Texas}}</ref> and later expanded by [[Thomas M. Cover|Thomas Cover]].<ref>{{cite journal |last=Altman |first=Naomi S. |author-link=Naomi Altman |title=An introduction to kernel and nearest-neighbor nonparametric regression |journal=The American Statistician |volume=46 |issue=3 |year=1992 |pages=175–185 |doi=10.1080/00031305.1992.10475879|hdl=1813/31637 |url=https://ecommons.cornell.edu/bitstream/1813/31637/1/BU-1065-MA.pdf |hdl-access=free }}</ref> It is used for [[statistical classification|classification]] and [[regression analysis|regression]]. In both cases, the input consists of the ''k'' closest training examples in a [[data set]]. The output depends on whether ''k''-NN is used for classification or regression:
 
:* In ''k-NN classification'', the output is a class membership. An object is classified by a plurality 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''&nbsp;=&nbsp;1, then the object is simply assigned to the class of that single nearest neighbor.