This is just the L2 distances (as the class name suggests).
So after saving and reloading a formerly Euclidean index, you must manually convert from L2 distances.
Fix for this will probably be to introduce a dedicated RcppHNSW::HnswEuclidean class which will do the square-rooting for you inside a method. This will be returned from hnsw_build when distance = "euclidean".
Build a Euclidean index via
hnsw_build
:So far so good. Now save it:
The class of
ann
is:so we should be able to load it with:
Now search again:
This is just the L2 distances (as the class name suggests).
So after saving and reloading a formerly Euclidean index, you must manually convert from L2 distances.
Fix for this will probably be to introduce a dedicated
RcppHNSW::HnswEuclidean
class which will do the square-rooting for you inside a method. This will be returned fromhnsw_build
whendistance = "euclidean"
.