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

Why normlize feature vector before searching in tinker? #29

Open
xiaozxiong opened this issue May 14, 2024 · 2 comments
Open

Why normlize feature vector before searching in tinker? #29

xiaozxiong opened this issue May 14, 2024 · 2 comments

Comments

@xiaozxiong
Copy link

I found that there is a normlization operation before searching in tinker.

const float* feature = normalization(context.get(), request->feature);

What is the purpose of this operation? And when I used the default parameter whether_norm=true, I got a recall@100 of almost zero. After I changed it to whether_norm=false, the recall@100 was correct. Could you offer me some possible explanations?

Thank you!

@nk2014yj
Copy link
Collaborator

The default distance calculation method is cosine similarity. The returned distance value is obtained by applying the transformation '2 - 2 * cosine similarity' to the cosine similarity value between two vectors.

For other distance calculation methods, it is necessary to update the value of whether_norm to false.

@xiaozxiong
Copy link
Author

Thank you for your reply.

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

2 participants