4 ms·
Hm, that article says cosine similarity ranges from 0 to 1, but it can range between -1 to 1 if the vectors are allowed negative components. Also FYI to any Po
by pamelafox 2y ago
Hm, that article says cosine similarity ranges from 0 to 1, but it can range between -1 to 1 if the vectors are allowed negative components.
Also FYI to any Postgres users: the pgvector operator is for cosine distance, which is 1 - cosine similarity, and thus ranges from 0 to 2 or 0 to 1.
- kurikuri 2y agoWhile cosine itself has a range of 0 to 1, the cosine similarity is usually defined for tf-idf or bag-of-words vectors, in which the largest angle between any two vectors is 90deg.