alexklibisz / elastiknn

Elasticsearch plugin for nearest neighbor search. Store vectors and run similarity search using exact and approximate algorithms.
https://alexklibisz.github.io/elastiknn
Apache License 2.0
370 stars 48 forks source link

Support for inner product similarity measures (dot product) #265

Open matt90luo opened 3 years ago

matt90luo commented 3 years ago

Is there any plan to support inner product similarity measures?

alexklibisz commented 3 years ago

Is that different from the cosine/angular similarity?

alexklibisz commented 3 years ago

Closing to keep things tidy. Feel free to re-open if you have any followup.

joancf commented 6 months ago

Is that different from the cosine/angular similarity?

Hi, i think that the dot product could be an improvement in performance, and easy to implement. As cosine_similarity(v1,v2) = dot_product(v1/v2)/(||v1|| * ||v2||)

using dot_product simplifies the computation as the magnitude of the vectors are not needed reducing the computation time to 1/3 of the original one, And most of the funcitonality is there