I am using SGD matrix factorisation (python) using the movielens dataset to make recommendations. I have a website which allows users to give feedback which is positive or negative to whether an item is a good recommendation for a particular movie.

I was wondering if I could use this feedback in my matrix factorisation. I wasn't 100% sure how I would proceed.

So for example I would have a vector like

  m1 m2 m3
m1 0 0  0
m2 5 0 -4
m3 0 0  0

Where m2-m1 is a score of 5 so with an example case where noone rated it negative, 5 people think its good. With the other for m2-m3 being -4 so a poor recommendation.

Any help would be greatly appreciated.

Edit: response from answer

I am currently using a sparse matrix for user item ratings and am using bias.

I have been trying to add additional input sources and am using the following to create a attribute matrix containing a genre representation:

for genre in item_genres:
       genres[genre] = 1
       self.attribute_item_matrix[i] = sum(list(genres.values()))

 pred = self.global_mean + self.bias_user[u] + self.bias_item[i] +np.dot(self.P[u, :],(self.Q[:, i]+self.attribute_item_matrix[i]))

However, I don't think this is correct as it eventually fails and causes a nan error.

I have been following this paper Matrix Factorisation Techniques for recommender systems



2 Answers 2


In my view, you should better go for user-movie matrix, to create a sparse matrix that can be more meaningful. By doing that, if you already know polarity of choices i.e. positive, negative or neutral, you may also have some intensity score of like or dislike like in case of rating. Now, if you want to just classify them as likes, neutral, and dislike, you may assign 1,0 and -1 respectively. This method can have more meaning when you have many movies and many users. Further this can help you establish user-user, movie-user and movie-movie relationship as well. These relationship can potentially help you understand and explore more about recommendation engines.

     m1 m2 m3 m4
u1 -1   0  -1  1
u2  1   1  -1  0
u3  0   0   1  0
u4  -1  1   1   0

If you want to add rating instead of just polarity, just add numbers scaled 0-1. I personally worked on them to write hybrid recommendation engines which have both collaborative filtering and context based filtering models embedded. I would suggest you to work more on relationships and try to explore more about next steps like possibility of like or dislike bias, association of movie info/ actors-directors influence and similarity in movies etc. I hope this explanation helps.


There are some factorization models that kind of work like that, you can do a search for 'session-based', 'basket-based', 'sequential' and others. But they tend not to perform very well. You can also use that data to create a classification or regression model and then mix it up with regular user-item-rating triplets in some hybrid model.


Your Answer

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

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