KlausVigo / kknn

Weighted k-Nearest Neighbors
http://klausvigo.github.io/kknn/
23 stars 10 forks source link

cv.kknn fold sizes are different #14

Open mkuehn10 opened 6 years ago

mkuehn10 commented 6 years ago

The line val<-sample(kcv, size=l, replace=TRUE) has the potential to make different sized folds for the cross-validation.

A simple fix could be to do val <- cut(seq(1, nrow(data)), breaks = kcv, labels = FALSE) instead to make the folds as similar in size as possible.

mkuehn10 commented 6 years ago

I also added a random shuffling of the rows of the data that is passed in prior to assigning folds.

data <- data[sample(nrow(data)),]

KlausVigo commented 6 years ago

Hi @mkuehn10 , thanks for the opening the issues and pull requests. I am giving a course this week, I will come back to this next week. Klaus

mkuehn10 commented 5 years ago

Hello @KlausVigo. Have you had any chance to look this over?