The 1-Nearest Neighbour (1NN) technique is a straightforward yet effective classification algorithm used in pattern recognition and data mining activities. It compares the test instance to all of the training examples and chooses the one with the shortest Manhattan Distance. The Manhattan Distance is a distance measurement that computes the distance between two locations on a grid.
1-Nearest Neighbor (1NN) with Manhattan Distance
The 1-Nearest Neighbour (1NN) technique is a basic yet strong classification approach in machine learning. It is frequently employed in pattern recognition and data mining jobs.
The 1NN method compares the test instance to all of the training examples and chooses the one with the shortest distance. The distance measure employed might vary, and we are using the Manhattan Distance in this situation.
Manhattan Distance
The Manhattan Distance (also known as L1 distance or city block distance) is a distance metric that is used to compute the distance between two places on a grid. The Manhattan Distance between two positions (x1, y1) and (x2, y2) is given by:
Manhattan Distance = |x2 - x1| + |y2 - y1|
For example, if we have two points A(3, 5) and B(7, 2), the Manhattan Distance between them would be:
Manhattan Distance = |7 - 3| + |2 - 5| = 4 + 3 = 7
The Manhattan Distance is utilized in the 1NN algorithm to determine the distance between the test instance and each training instance. As the nearest neighbor, the training instance with the shortest Manhattan Distance is picked.