Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I am trying to run rknn with rknn package but it appears an error I am not able to understand. Here's the code and the error:

rknn(bank_training, bank_testing, y_n, k=2, r=100, mtry=4)

Error in knn(train = data[, fset], test = newdata[, fset], cl = y, k = k,  : 
too many ties in knn

I tried to run it with different values of r from 10-500 but i get the same error and I don't understand what is meant with that. I ran it also as it is described in the manual (See below), but i get always the same error.

rknn(data, newdata, y, k = 1, r = 500, mtry = trunc(sqrt(ncol(data))),
Random.seed = NULL, seed = NULL, knn.algo="VR")

Does anyone have an idea why is that?

Thanks in advance!

share|improve this question
3  
I'm not familiar with this package but this appears to be saying that there are too many ties in terms of which neighbor is nearest. This can happen when you have a very discrete variable (i.e. it only takes on a few unique values) you're trying to cluster on - is that the case here? – Macro Jul 24 '12 at 12:33
2  
Can you reproduce this error by just using class::knn (which rknn seems to use if I read the code correctly)? In this case, you probably want to take a look at this R-help thread: error in knn: too many ties in knn. – chl Jul 24 '12 at 14:27
with class:knn it works, i have already tried it – blerta Jul 25 '12 at 17:55

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.