faiss
faiss copied to clipboard
Why is the cosine similarity > 1?
faiss.normalize_L2(feature)
faiss.normalize_L2(query_vector)
index = faiss.IndexFlatIP(feature.shape[1])
index = faiss.IndexIDMap2(index)
index.add_with_ids(feature, label)
simi, ID = index.search(query_vector, k)
Why the result will be greater than 1? eg:
1.0000001192092896, 0.4944802522659302, 0.46121683716773987
0.9999998807907104, 0.785945475101471, 0.7602823972702026
Hi @MrHwc, I can reproduce the same issue. Is this a numerical overflow problem?
I'm having the same problem. @MrHwc @elopezz How do you guys address this problem?
Yes, it's numerical overflow problem for me.