O'Reilly logo

Mastering Python Data Visualization by Kirthi Raman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

k-nearest neighbors

The k-nearest neighbor (k-NN) classification is one of the easiest classification methods to understand (particularly when there is little or no prior knowledge about the distribution of the data). The k-nearest neighbor classification has a way to store all the known cases and classify new cases based on a similarity measure (for example, the Euclidean distance function). The k-NN algorithm is popular in its statistical estimation and pattern recognition because of its simplicity.

For 1-nearest neighbor (1-NN), the label of one particular point is set to be the nearest training point. When you extend this for a higher value of k, the label of a test point is the one that is measured by the k nearest training points. The k-NN ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required