Algorithm · OpenAI · Easy
Problem: 1-Nearest Neighbor Classification with Manhattan Distance There are n labeled training samples. Each one is a point with d integer coordinates together with a class label. For every query point, assign a label with the 1-nearest neighbor (1NN) rule: Measure closeness with Manhattan distance between a query point a and a training point b: $$dist(a,b)=\sum_{j=1}^{d} a_j-b_j $$ The predicted label is the label of the training point at the smallest distance. If several…