Suppose we have a 1 - Nearest Neighbor classifier f, created from training data set S with its associated labels. We also have a training data set T which does not contain the associated labels. When we calculate the training error rate
err(f, s) = 0 = # of (x,y) element of S such that f(x) != y / |S|
What I am confused about is how we calculate the test error rate.
err(f, t)
More specifically, if we use the classifier from f to determine the test data's labels, we don't necessarily know if that is the right or wrong label, since we don't have an actual associated label for the test data, its a prediction based off the training data.
Typically, you will have a data set which you split into a training set and a test set; these both have known labels. In the case of k-NN, you compare the test set to the training set based on some distance metric and can deduce the error rate based on the number of successful classifications.
This way you can evaluate how well your model performs before you try it on data where you do not know the class. You can't deduce an error rate if you don't know which class your data is in.