7
$\begingroup$

Lets say I have a database of users who rate different products on a scale of 1-5. Our recommendation engine recommends products to users based on the preferences of other users who are highly similar. My first approach to finding similar users was to use Cosine Similarity, and just treat user ratings as vector components. The main problem with this approach is that it just measures vector angles and doesn't take rating scale or magnitude into consideration.

My question is this:

Are there any drawbacks to just using the percentage difference between the vector components of two vectors as a measure of similarity? What disadvantages, if any, would I encounter if I used that method, instead of Cosine Similarity or Euclidean Distance?

For Example, why not just do this:

n = 5 stars
a = (1,4,4)
b = (2,3,4)

similarity(a,b) = 1 - ( (|1-2|/5) + (|4-3|/5) + (|4-4|/5) ) / 3 = .86667

Instead of Cosine Similarity :

a = (1,4,4)
b = (2,3,4)

CosSimilarity(a,b) = 
(1*2)+(4*3)+(4*4) / sqrt( (1^2)+(4^2)+(4^2) ) * sqrt( (2^2)+(3^2)+(4^2) ) = .9697
$\endgroup$

2 Answers 2

5
$\begingroup$

Rating bias and scale can easily be accounted for by standardization. The point of using Euclidean similarity metrics in vector space co-embeddings is that it reduces the recommendation problem to one of finding the nearest neighbors, which can be done efficiently both exactly and approximately. What you don't want to do in real-life settings is to have to compare every item/user pair and sort them according to some expensive metric. That just doesn't scale.

One trick is to use an approximation to cull the herd to a managable size of tentative recommendations, then to run your expensive ranking on top of that.

edit: Microsoft Research is presenting a paper that covers this very topic at RecSys right now: Speeding Up the Xbox Recommender System Using a Euclidean Transformation for Inner-Product Spaces

$\endgroup$
2
  • $\begingroup$ Do you see any problems with using the simple difference averaging approach I wrote above? It seems like an ok stand in for a similarity measure in a K-NN approach and it's just as lightweight as Euclidean Distance. $\endgroup$
    – Myclamm
    Oct 9, 2014 at 5:36
  • $\begingroup$ No, it actually has a name: Manhattan similarity. $\endgroup$
    – Emre
    Oct 9, 2014 at 5:45
5
$\begingroup$

For ratings, I think you would need to use Spearman's rank correlation for your similarity metric.

Cosine similarity is often used when comparing documents, and perhaps would not be a good fit for rank variables. Euclidean distance is fine for lower dimensions, but comparison of rank variables normally call for Spearman.

Here's a question on CrossValidated regarding Spearman (vs Pearson), which might shed more light for you.

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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