A problem I'm working on states:
Computes the squared Euclidean distance between each element of the training set and each element of the test set. Images should be flattened and treated as vectors.
The training set is a tensor of dimensions: [500, 3, 32, 32]
The test set is a tensor of dimensions: [250, 3, 32, 32]
The dataset is a subsample from CIFAR-10, so these are images. I've flattened both making their dimensions [500, 3072] and [250, 3072] respectively, but I run into a couple questions.
- Isn't the process of kNN to find the nearest "majority" neighbor of a particular example? Why is step 1 asking me to find a distance between the training and test set here, which makes no sense? (I currently see it as taking the pixel value difference between two random & unrelated pictures.)
- Shouldn't I instead be finding a distance between the training set a "label", then classify the example to the label with the lowest distance?
I get that the label is a scalar value so taking the actual difference between it and an example is incorrect, I'm just trying to understand it more conceptually. I've tried to not add code to clear headspace, but can toss it in if needed.