3
$\begingroup$

When does it makes senses to use Dot-Product as similarity measure instead of Cosine?. I have seen there is already question asked about this, However that merely explains the difference between calculation of dot-product & cosine and it does not focus on when should we use one vs another with real world example.

$\endgroup$
2
$\begingroup$

Borrowing from this Quora answer -- which includes some concrete examples of when you might prefer one measure over the other -- it comes down to whether you care about taking the magnitude of the vectors into account. This is highly domain-specific, but the example used there is in information retrieval, where magnitude represents the length of the documents in question. The dot product will take the document length into account, whereas the cosine similarity will not.

In general, you will want to have good reasons specific to your problem space to use one over the other.

|improve this answer|||||
$\endgroup$
1
$\begingroup$

When we want cluster items use distances as similarity measure. For example, we use Euclidean distances(square root of inner product) in k-means clustering as a similarity measure. Squared Euclidean distances are used as a similarity measure in Ward's method of clustering. However, when we want to cluster variables, we use correlation(cosine) as a measure of similarity.

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Can you elaborate on what you mean by "variables"? $\endgroup$ – D.W. Dec 8 '16 at 22:16
  • $\begingroup$ Context is cluster analysis. We measure each item on number of variables and using some proximity measure, cluster items into groups. There may exist correlations among the variables. Clustering variables may help detect redundancies in variables. Hierarchical agglomerative methods are usually employed for this purpose. Similarity measure used is correlation. $\endgroup$ – L.V.Rao Dec 9 '16 at 3:04
1
$\begingroup$

The relation between dot product and cosine is similar to the relation between covariance and correlation: one is normalized and bounded version of another.

In my experience usual dot product is better when you also care about the number of dimensions two vectors have in common (i.e. non zero values in these dimensions with the same sign). For example, it can be matchings tags or attributes. For usual texts cosine typically works better.

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.