tdunning / knn

Large scale k-nn experiments
http://mahout.mapr.com
68 stars 21 forks source link

ArrayIndexOutOfBound Exception #6

Closed baunz closed 5 years ago

baunz commented 11 years ago

Hi, without being fully into it, i guess in FastProjectionSearch, this

while (r >= 0 && projections.get(i)[r] >= projection - epsilon2) { r--; }

should become while(r > 0)

since r is decremented to -1 and in the following loop r is used as an index.

while (r < referenceVectors.size() && projections.get(i)[r] <= projection + epsilon2) { candidates.add(vectorIds.get(i)[r]); r++; }

cheers,

johannes

dfilimon commented 11 years ago

Hi!

I'm working with Ted on this project in my own branch [1] and we're merging pull requests periodically. :)

I can confirm the issue you talk about and have just rewritten the FastProjectionSearch [2] code.

Could you please try out this version instead? From what I've tested with the FastProjectionSearchTest and StreamingKMeansTest it seems to work.

Thanks!

[1] https://github.com/dfilimon/knn [2] https://github.com/dfilimon/knn/blob/master/src/main/java/org/apache/mahout/knn/search/FastProjectionSearch.java

baunz commented 11 years ago

Hi,

thanks for the quick response! I cloned your repository, but i wonder how this compiles with classes called BallKMeans when the file is called BallKmeans with a lowercase m? This is not scala, heh? :D Or did i miss something?

dfilimon commented 11 years ago

Heh, I thought that was fixed. I renamed it in the editor but unfortunately I'm on a Mac which is case insensitive by default and it just considers BallKmeans.java and BallKMeans.java to be the exact same file.

I fixed it by renaming it twice... OS X, the world's most advanced operating system. Clearly.

Anyway, are you having any more issues?

baunz commented 11 years ago

Thanks a lot. By now I'm totally satisfied :)