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

Probable error in cosine similarity #11

Open
gyrdym opened this issue Feb 9, 2024 · 1 comment
Open

Probable error in cosine similarity #11

gyrdym opened this issue Feb 9, 2024 · 1 comment

Comments

@gyrdym
Copy link

gyrdym commented Feb 9, 2024

return 1.0 - distance;

Hello,

Being an author of ml_linalg library, I found an error here.

In fact, 1-* is already considered in Vector.distanceTo:

https://github.com/gyrdym/ml_linalg/blob/027ddfab120b1e2d0c4d6b676c31e62615ce2374/lib/src/vector/float32x4_vector.dart#L521

P.S. Your library is awesome!

@gyrdym
Copy link
Author

gyrdym commented Feb 9, 2024

Hmm, maybe I got it wrong, since the method is called similarity - so indeed maybe you need to subtract cosine distance from 1

@gyrdym gyrdym changed the title Error in cosine similarity Probable error in cosine similarity Feb 9, 2024
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

No branches or pull requests

1 participant