I have a KNN model that I used to predict the close price on houses.
library(kknn)
library(metrics)
KNN <- kknn(formula = scale(close_price) ~.,
train.data,
test.data,
k = 4,
distance = 2,
kernel = "optimal"
)
mdae(test.data$close_price, KNN$fitted.values)
When I center and scale my response variable (as I believe I'm supposed to since KNN relies on Euclidean distance), I get a median relative absolute error of 185272
.
When I don't center and scale, I get a median relative absolute error of 32590
.
I assume these are in the same units since the formula applies to the training data and the predictions should use the regular close prices without scaling them. But, the difference seems to big to be reasonable.
Are they in the same units and should I be centering and scaling my response variable for KNN?