hnswlib
hnswlib copied to clipboard
Where is Cosine similarity in C++ version
Hi, I'm wondering why there is no cosine space in hnswlib. How to use cosine similarity in C++ version? Thanks
Hi @bejoechen,
For cosine you can first normalize the vectors and then use inner product or L2 (inner product would be a bit faster). You can use the normalization logic from the python bindings https://github.com/nmslib/hnswlib/blob/443d667478fddf1e13f2e06b1da4e1ec3a9fe716/python_bindings/bindings.cpp#L166