In thinking about this 'problem' last night, I found the 'solution'. Any NN
algorithm needs to keep track of all the data it is given, both X and Y
data, otherwise how could it find and report the nearest neighbour! When
predicting (i.e. predict.kknn) it will find the closest match (nearest
I am noticing that there is a difference between the fitted.values returned
by train.kknn, and the values returned using predict with the same model and
dataset. For example:
data (glass)
tmp - train.kknn(Type ~ ., glass, kmax=1, kernel=rectangular,
distance=1)
tmp$fitted.values
[[1]]
[1] 1
2 matches
Mail list logo