hnswlib icon indicating copy to clipboard operation
hnswlib copied to clipboard

Why is entor point not updated?

Open orrorcol opened this issue 5 years ago • 11 comments

https://github.com/nmslib/hnswlib/blob/68c5531caa8be522b19ac20088ffca39d1474520/hnswlib/hnswalg.h#L842-L854

This is different from the algorithm in the paper image

I think that currObj should be set to top_candidates.top().second.

orrorcol avatar Jun 22 '19 10:06 orrorcol

@wslfs Yeap, it is a bug.

yurymalkov avatar Jun 24 '19 15:06 yurymalkov

@yurymalkov if I remember correctly, there was an issue in NMSLIB that complained about it too. However, some experiments showed that fixing the bug didn't help the overall performance. :-)

searchivarius avatar Jun 24 '19 15:06 searchivarius

@searchivarius Well, it should have a big influence for the case of low dimensional data.

yurymalkov avatar Jun 24 '19 19:06 yurymalkov

Thank you, I will create a pull request.

orrorcol avatar Jun 25 '19 00:06 orrorcol

Is there a reason this has not been merged to master yet ?

jelmerk avatar Jul 10 '19 03:07 jelmerk

@jelmerk I guess they will merger new pull request to branch develop before merged into master. This will make the master branch more stable.

orrorcol avatar Jul 10 '19 04:07 orrorcol

Sounds like we should set currObj to be the closest one from last layer. set to top_candidates.top() seems set to a farest one since top_candidates is a max_heap. correct me if wrong. @uestc-lfs

guocuimi avatar Feb 11 '20 02:02 guocuimi

@guocuimi I think you are right.

orrorcol avatar Feb 11 '20 09:02 orrorcol

I forget to reopen this issue. I think @guocuimi is right. @yurymalkov I think this line should be changed, https://github.com/nmslib/hnswlib/blob/3c6a84fb54a2a92dc4b7dc3e13dbae3d99892444/hnswlib/hnswalg.h#L409

orrorcol avatar Jun 23 '20 13:06 orrorcol

And these lines, commited by me : https://github.com/nmslib/hnswlib/blob/3c6a84fb54a2a92dc4b7dc3e13dbae3d99892444/hnswlib/hnswlib.h#L74-L76 The interface is not virtual, so it can not be overrided and it is not polymorphism. I suggest removing the template. Sorry for the bad code commited by me

orrorcol avatar Jun 23 '20 14:06 orrorcol

I am not sure what is the problem. Can you do a PR?

yurymalkov avatar Jun 27 '20 05:06 yurymalkov