Page 20 - Data Science Algorithms in a Week
P. 20
Classification Using K Nearest Neighbors
Now, suppose we would like to find out how Mary feels at the temperature 16 degrees
Celsius with a wind speed of 3km/h using the 1-NN algorithm:
For simplicity, we will use a Manhattan metric to measure the distance between the
neighbors on the grid. The Manhattan distance d Man of a neighbor N =(x ,y ) from the
1
1
1
neighbor N =(x ,y ) is defined to be d Man =|x - x |+|y - y |.
1
2
2
2
2
2
1
[ 8 ]