opendistro-for-elasticsearch / k-NN

🆕 A machine learning plugin which supports an approximate k-NN search algorithm for Open Distro.
https://opendistro.github.io/
Apache License 2.0
277 stars 55 forks source link

Approximate k-NN cosinesimil use wrong Elasticsearch Score #348

Closed Hronom closed 3 years ago

Hronom commented 3 years ago

Here we have Elasticsearch Score for cosinesimil in Approximate k-NN https://opendistro.github.io/for-elasticsearch-docs/docs/knn/approximate-knn/#spaces image

The wrong is score = 1 / (1 + Distance Function) and lower score equates to a closer and better result. This means negative cosinesimil will push doc's on top.

However here https://opendistro.github.io/for-elasticsearch-docs/docs/knn/knn-score-script/#spaces the Elasticsearch Score is correct 1 + Distance Function image

Hronom commented 3 years ago

Error is on our side, all good with Elasticsearch, closing