Skip to content

Commit

Permalink
Change cosine similarity to distance in README
Browse files Browse the repository at this point in the history
Issues #532 and #456
  • Loading branch information
yurymalkov authored Dec 28, 2023
1 parent 0d9f192 commit e2ca570
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Description of the algorithm parameters can be found in [ALGO_PARAMS.md](ALGO_PA
| ------------- |:---------------:| -----------------------:|
|Squared L2 |'l2' | d = sum((Ai-Bi)^2) |
|Inner product |'ip' | d = 1.0 - sum(Ai\*Bi) |
|Cosine similarity |'cosine' | d = 1.0 - sum(Ai\*Bi) / sqrt(sum(Ai\*Ai) * sum(Bi\*Bi))|
|Cosine distance |'cosine' | d = 1.0 - sum(Ai\*Bi) / sqrt(sum(Ai\*Ai) * sum(Bi\*Bi))|

Note that inner product is not an actual metric. An element can be closer to some other element than to itself. That allows some speedup if you remove all elements that are not the closest to themselves from the index.

Expand Down

0 comments on commit e2ca570

Please sign in to comment.