How do I avoid time leakage in my KNN model?
I am building a KNN model to predict housing prices. I'll go through my data and my model and then my problem. Data - # A tibble: 81,334 x 4 latitude longitude close_date close_price <dbl> <dbl> <dttm> <dbl> 1 36.4 -98.7 2014-08-05 06:34:00 147504. 2 36.6 -97.9 2014-08-12 23:48:00 137401. 3 36.6 -97.9 2014-08-09 04:00:40 239105. Model - library(caret) training.samples <- data$close_price %>% createDataPartition(p = 0.8, list = FALSE) train.data <- data[training.samples, ] test.data <- data[-training.samples, ] model <- train( close_price~ ., data = train.data, method = "knn", trControl =