facebookresearch / pysparnn

Approximate Nearest Neighbor Search for Sparse Data in Python!
Other
916 stars 145 forks source link

Sorting based on `string` type. Problems when distance is very small value ('5.55555E-6') #35

Open JoanFM opened 3 years ago

JoanFM commented 3 years ago

We have observed some weird behavior seeing small distances at the end of the list of closest matches.

I believe the problem is that the distances are returned as string types and then the sorting does not work

https://github.com/facebookresearch/pysparnn/blob/c299c825fd99f263f3957e9b31197daf23a1e7a3/pysparnn/cluster_index.py#L26

JoanFM commented 3 years ago

Problem appears when keys indexed are of type str