4
$\begingroup$

I am doing Information Retrieval using Cosine Similarity.

My data is a binary vector.

Since most of the references I read were using non-binary vector (non-binary matrix) data, I am wondering if it is wrong to use binary vector data in the cosine similarity function.

$\endgroup$

4 Answers 4

2
$\begingroup$

Consider looking at the Jaccard coefficient and Tanimoto coefficient. These two are probably a bit more sensible for binary data.

You can obviously use cosine distance, but computing it this way makes things overcomplicated when you have binary data. The dot product boils down to computing the size of the intersection set, the vector length are the number of bits set. Realizing that you are just looking at set sizes leads to more straightforward and fast ways of computing these things.

$\endgroup$
1
$\begingroup$

Using binary vector data works perfectly for doing cosine similarity studies. Actually, it makes the arithmetic much simpler because the magnitude of each vector is simply equal to the squareroot of the sum of its entries.

$\endgroup$
1
  • $\begingroup$ see also the Ochiai coefficient $\endgroup$
    – Joffer
    May 22, 2016 at 20:42
1
$\begingroup$

You may perfectly use cosine similarity to compare binary vectors. But if computational performance is an important issue you may use Hamming Distance instead, since it is just the number of positions at which the corresponding symbols are different.

$\endgroup$
0
$\begingroup$

In a similar senario with binary vectors (recommender systems in my case which can be see as a special case of information retrieval) I had very good success with cosine similarity.

When measuring Rankscore I got much better rate on my retrievals when I used Cosine similarity than with the Tanimoto coefficient, but this might be very application specific. You should probably experiment with different similarity measurements and see what yields the best result in you application.

I compare the result of the effects from different similarity measures between my binary vectors here. As mentioned above I have the greatest success with cosine similarity.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .