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

Fix cosine normalization #213

Merged
merged 3 commits into from
Jul 22, 2023
Merged

Fix cosine normalization #213

merged 3 commits into from
Jul 22, 2023

Conversation

kacperlukawski
Copy link
Member

This PR enables the normalization of vectors if cosine distance is used as reported in #212. It also enables vector comparison in tests, as the previous scroll call did not return vectors. In addition to that, the vectors are compared with atol=1e-3 as random vectors are rounded upon generation:

return np.random.random(vector_sizes).round(3).tolist()

@kacperlukawski kacperlukawski requested a review from joein July 14, 2023 10:49
@netlify
Copy link

netlify bot commented Jul 14, 2023

Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit 66f8510
🔍 Latest deploy log https://app.netlify.com/sites/poetic-froyo-8baba7/deploys/64bc31a1e9250c0008451f4f
😎 Deploy Preview https://deploy-preview-213--poetic-froyo-8baba7.netlify.app/qdrant_client.conversions.conversion
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kacperlukawski kacperlukawski requested a review from generall July 14, 2023 10:50
@joein joein force-pushed the fix-cosine-normalization branch from 3fff087 to 66f8510 Compare July 22, 2023 19:44
@joein joein merged commit c7f221e into master Jul 22, 2023
@poutyface
Copy link

eps is needed if all vectors are zero

@joein
Copy link
Member

joein commented Jul 28, 2023

fair point

but why would anyone like to store zeroed vectors?

@joein
Copy link
Member

joein commented Jul 28, 2023

#236

@poutyface
Copy link

That's true. I found it when I was inputting the raw sensor data. But it might happen when you want to use high dimensional learned latent vectors (Black images, or vq-vae encoder vector)

@kacperlukawski kacperlukawski deleted the fix-cosine-normalization branch October 4, 2023 14:38
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.

3 participants