I have a question about basic understanding of how item-item collaborative filtering of "Graphlab" library works. I run this code:

f = graphlab.SFrame({'user_id': ['0', '0', '0', '1', '1', '2', '2'],
                     'item_id': ['a', 'b', 'c', 'a', 'b', 'b', 'c'],
                     'rating': [ 1,   3,   2,   5,   4,   1,   4]})
m = graphlab.item_similarity_recommender.create(f, target="rating", similarity_type='cosine')

print m.get_similar_items(verbose=True)
print m.recommend()

The output is:


The matrix form of data: matrix

According to the model, the recommendation for (1,c) is 1.096 but according to my calculation it is 4.16! My calculation:

(1,c) = (sim(c,a)*5 + sim(c,b)*4)/(sim(c,a) + sim(c,b))
      = (0.0877*5 + 0.4385*4)/(0.0877+0.4385)
      = 4.16

Please help, what am I missing?

  • $\begingroup$ something is not right as it doesnt align with the documentation on: turi.com/products/create/docs/generated/… If you run my test code for a 2 and 1 user case you can see that the score for 1 user case multiplies sim(a,b)*R which give the score/prediction. It does not divide by sim(a,b) as stated in the documentation. For the 2 user case I have tried several combinations, but still cant work out how they even get the score/prediction. $\endgroup$
    – mkap
    Nov 29 '16 at 3:08

Your Answer

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

Browse other questions tagged or ask your own question.