Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scores returned by Astra are not comparable to Similarity Score #108

Open
bjchambers opened this issue Feb 4, 2025 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@bjchambers
Copy link
Collaborator

Describe the bug
Astra returns a similarity score normalized to [0, 1]. cosine_similarity function returns a score in the range [-1, 1].

These can be converted:

  • To Astra: (x + 1.0) / 2.0
  • From Astra: (x / 2.0) - 1.0

This matters when we are sorting elements by score, since the two will not be comparable.

Expected behavior

We should probably have the Astra adapter convert to the values returned from cosine_similarity.

@bjchambers bjchambers added the bug Something isn't working label Feb 4, 2025
@bjchambers bjchambers self-assigned this Feb 4, 2025
@bjchambers
Copy link
Collaborator Author

Also may be worth have the Astra adapter verify the collection is configured to use cosine similarity (instead of other metrics).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant