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

feat: Using cosine similarity #4124

Merged

Conversation

frascuchon
Copy link
Member

@frascuchon frascuchon commented Nov 2, 2023

Description

This PR changes the l2_norm distance to the cosine similarity for vector search. This change can improve results on similarity searches and also for least similarity searches.

This PR must be reviewed first

Closes #4123

Type of change

(Please delete options that are not relevant. Remember to title the PR according to the type of change)

  • New feature (non-breaking change which adds functionality)
  • Refactor (change restructuring the codebase without changing functionality)
  • Improvement (change adding some improvement to an existing functionality)

How Has This Been Tested

(Please describe the tests that you ran to verify your changes. And ideally, reference tests)

The base dataset has been used with boh ElasticSearch and OpenSearch to verify this change.

Checklist

  • I added relevant documentation
  • I followed the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I filled out the contributor form (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

Copy link

codecov bot commented Nov 2, 2023

Codecov Report

Attention: 172 lines in your changes are missing coverage. Please review.

Files Coverage Δ
src/argilla/__init__.py 86.66% <ø> (ø)
src/argilla/client/feedback/schemas/__init__.py 100.00% <100.00%> (ø)
src/argilla/client/feedback/schemas/records.py 96.42% <100.00%> (-2.66%) ⬇️
.../argilla/client/feedback/schemas/remote/records.py 53.53% <100.00%> (-35.25%) ⬇️
.../client/feedback/schemas/remote/vector_settings.py 100.00% <100.00%> (ø)
...argilla/client/feedback/schemas/vector_settings.py 100.00% <100.00%> (ø)
src/argilla/client/sdk/commons/errors_handler.py 12.90% <ø> (-77.73%) ⬇️
src/argilla/client/sdk/v1/datasets/models.py 100.00% <100.00%> (ø)
src/argilla/server/apis/v1/handlers/records.py 98.73% <100.00%> (+0.08%) ⬆️
...rgilla/server/apis/v1/handlers/vectors_settings.py 100.00% <100.00%> (ø)
... and 30 more

... and 90 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

Copy link

github-actions bot commented Nov 2, 2023

The URL of the deployed environment for this PR is https://argilla-quickstart-pr-4124-ki24f765kq-no.a.run.app

@frascuchon frascuchon merged commit bdb2871 into feature/add-sdk-search-records Nov 3, 2023
13 of 16 checks passed
@frascuchon frascuchon deleted the refactor/using-cosine-similarity branch November 3, 2023 12:15
@frascuchon frascuchon linked an issue Nov 4, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Using cosine similarity for vector search
3 participants