O'Reilly logo

OpenCL Programming by Example by Koushik Bhattacharyya, Ravishekhar Banger

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 Neighborhood (k-NN) algorithm

In machine learning classification is the problem of identifying class/type of a given input quantity. Formally the problem can be stated like, we have a set of classes/types represented by:

C={t(1), t(2),…, t(m)}. 

We have a set P of objects, each of which is described by a vector. All the objects of P have a unique class from C. From P we are given n objects (that is their representative vectors) p(1), p(2), …, p(n) (each p(i) is d-dimensional vector) and for each one of them p(i) the class is also given c(i). These n vectors with their classes ( p(i) , c(i)) are called as the training data. We are given a distance measure d( p1 , p2) that gives the relevant distance between two vectors of P. Now, we are ...

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