Closed RomeroBarata closed 6 years ago
Here is a reproducible example:
set.seed(123) data_train <- data.frame(a = rnorm(3), b = rnorm(3), c = c("X0", "X0", "X1")) data_test <- data.frame(a = rnorm(5), b = rnorm(5)) # For k >= 2, knn${CL, W, D, C, prob} are all matrices. knn <- kknn::kknn(c ~ ., train = data_train, test = data_test, k = 2, kernel = "rectangular") knn$C # However, for k == 1, knn${CL, W, prob} are matrices while knn${D, C} are vectors. knn <- kknn::kknn(c ~ ., train = data_train, test = data_test, k = 1, kernel = "rectangular") knn$C
Dear @RomeroBarata, thanks for the bug report. This should be fixed now.
Here is a reproducible example: