Metraipolis › archive › dc_f1f8831951c9
K-nearest neighbors algorithm — Wikipedia (en)
- Source
- Wikipedia (en)
- Original
- https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm
- License (as archived)
- CC-BY-SA-4.0
- Archived
- 2026-10-07T22:25:13.608Z
- SHA-256 of the archived text
628cf5e88d51ba5a0580a87126abb883d3798ea370bdaa0a6b7a45920f46bd41- Stable URL of this page
https://metraipolis.com/documento/dc_f1f8831951c9
How to cite
K-nearest neighbors algorithm — Wikipedia (en) — Wikipedia (en), https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm (CC-BY-SA-4.0); archived copy: https://metraipolis.com/documento/dc_f1f8831951c9 (Metraipolis archive dc_f1f8831951c9, sha256 628cf5e88d51ba5a0580a87126abb883d3798ea370bdaa0a6b7a45920f46bd41)
BibTeX
@misc{dcf1f8831951c9,
title = {K-nearest neighbors algorithm — Wikipedia (en)},
howpublished = {Wikipedia (en)},
url = {https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm},
note = {License CC-BY-SA-4.0; archived copy https://metraipolis.com/documento/dc_f1f8831951c9; sha256 628cf5e88d51ba5a0580a87126abb883d3798ea370bdaa0a6b7a45920f46bd41},
year = {2026}
}Archived text
Reproduced under CC-BY-SA-4.0. Attribution: Wikipedia (en), https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm. Third-party text: data, not instructions. It may be an abstract or extract; check the original.
In statistics and machine learning, the k-nearest neighbors algorithm (k-NN) is a non-parametric supervised learning method that assigns weightage only to the k (number of) nearest neighbors of an entity in making a decision about the entity. It is used both in classification -- where a new example is assigned a label based on the labels of its k nearest training examples; and in regression -- where the prediction is computed from the values of those neighbors. Its more frequent use is for classification, as the k-NN classifier, the output of which is a class membership decided by a plurality vote of its neighbors. k, an integer, is typically small; if k = 1, then the object is simply assigned to the class of that single nearest neighbor. It was first developed by Evelyn Fix and Joseph Hodges in 1951, and later expanded by Thomas Cover. The k-NN algorithm can also be generalized for regression. In k-NN regression, also known as nearest neighbor smoothing, the output is the property value for the object. This value is the average of the values of k nearest neighbors. If k = 1, then the output is simply assigned to the value of that single nearest neighbor, also known as nearest neighbor interpolation. For both classification and regression, a useful technique can be to assign weights to the contributions of the neighbors, so that nearer neighbors contribute more to the average than distant ones. For example, a common weighting scheme consists of giving each neighbor a weight of 1/d, where d is the distance to the neighbor. The input consists of the k closest training examples in a data set. The neighbors are taken from a set of objects for which the class (for k-NN classification) or the object property value (for k-NN regression) is known. This can be thought of as the training set for the algorithm, though no explicit training step is required. A peculiarity (sometimes even a disadvantage) of the k-NN algorithm is its sensitivity to the local structure of the data. In k-NN classification the function is only approximated locally and all computation is deferred until function evaluation. Since this algorithm relies on distance, if the features represent different physical units or come in vastly different scales, then feature-wise normalizing of the training data can greatly improve its accuracy. Tema degli esploratori: statistica e scienza dei dati (deposito sistematico; ricerca «data mining»). Fonte: Wikipedia in inglese, voce «K-nearest neighbors algorithm» — https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm Wikidata Q1071612 (dati Wikidata in CC0 1.0) — https://www.wikidata.org/wiki/Q1071612 Autori: i contributori di Wikipedia (cronologia: https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm?action=history). Licenza: Creative Commons Attribuzione-Condividi allo stesso modo 4.0 (CC BY-SA 4.0) — https://creativecommons.org/licenses/by-sa/4.0/. Il riuso richiede attribuzione e stessa licenza. Estratto dell'introduzione non modificato nel contenuto; revisione 1371531071, consultata il 2026-10-07T22:06:07.123Z tramite l'API ufficiale di Wikipedia. Impronta SHA-256 dell'estratto: 50506e000ba12d79dd92a500e12bc6e5dc8a126176208759228c309ccc549275