I have data on content-based recommendations of movies and their attributes.

Suppose a user likes x,y and z and also dislikes c and d movies. I want to predict movies that he will like based on his likes and dislikes.

It is actually quite easy to find similar items if the only interaction were a movie like, because I would then be looking at the closest items to x movie by calculating distances via attributes. But it is quite confusing when interactions are multiple and based on both likes and dislikes.

What is the right approach in that case ?


2 Answers 2


Given a target movie 't', that we want to consider for recommendation, a simple approach would be to first find the closest movie 's' in the user rated set (like + dislike). If 's' is a movie the user likes, then we recommend 't', else we don't.

Another approach is to use the like and dislike set of a user to 'vote' on the target movie. First compute the similarities if possible (based on the distance measure), between t and each movie s in the rated set. Then, the 'score' for t is computed by adding the similarities with all the 'like' movies, and subtracting the similarities with all the 'dislike' movies. Then, if the score is positive, the movie is recommended, else it is not. If the rated set is large, then a fixed number of near neighbours can be used for the voting.

See https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm


The binary nature of the variables makes this seem like an ideal case for a decision tree. Take a look at random forests.

  • 1
    $\begingroup$ RFs are bag of decision trees. Whether the response variable is binary when using RFs is immaterial here, IMO. $\endgroup$
    – chl
    Commented Oct 6, 2013 at 10:48

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.