Sunday, May 24, 2015

Recommendations

The today post is about recommendations, which seem to be everywhere nowadays from online shopping stores, to news sites, movies and music sites. They became so popular because of the vast amount of offered choices out there; so many clothes to wear, so many books to read, so many movies to watch. Going through all these choices one by one is impossible for the end user. 

A solution for the user would be  filtering of the offered items based on criteria like author in case of a book, or director in case of a film.  Filtering is one way to restrict the selection to fewer items but the quality of the results really depends on the filtering itself. A bad filtering might result in user missing some interesting items. Moreover filtering doesn’t consider user preferences as “captured” by his/her previous “behavior”. And also, filtering requires a lot of effort from the user side, as the user should specify what are the filtering criteria.

Recommendations help in this direction in the sense that they exploit the customer “past behavior” in order to “infer” what he/she might be interested in currently. The inference is a key factor here, a recommender tries to guess what a user might like indirectly from his "past behavior". In that sense, the user involvement is limited. 

Before proceeding with how recommendations are issued, let's introduce a more formal problem description. The best way to "visualize" the problem, is by considering a matrix R with |U| rows and |I| columns. The rows represent the users, whereas the columns the items of our recommendation application. Each cell r_{ij} in this matrix indicates the rating of the corresponding user u_i \in U for the item i_j\in I. Obviously, not all items are rated by users; the corresponding entries in the matrix are null. Actually, most of the entries are null because typically there are many many items in a recommendation applications and users rate only a few of them. This is known as the sparsity problem in recommendations. 

There is a large variety of recommendation systems, from collaborative filtering to user models. We will now focus on collaborating filtering as a way of inferring recommendations for a user.

Collaborative filtering

In collaborative filtering, the recommendations to a query user u are based on other similar users. These are users which exhibit similarity to the query user w.r.t. their purchases/ preferences. The idea is that if I as a user have similar purchase behavior to you then items that you have bought, but I don’t so far, can be of potential interest to me.

So the critical part is how to locate such similar users. This is done through some similarity function that evaluates how similar two users are based on their purchased items and ratings upon these items. Cosine similarity and Pearson Correlation comprise popular similarity functions choices.

Once the similar users to the query user are identified, for each item i unrated by the query user a prediction is made using the corresponding ratings of his similar users that have rated the specific item. The user similarity is used as a weight upon the rating, so as more similar users contribute more comparing to less similar ones. That is, for each similar user u' of u, the rating of u' on item i, denoted by r_{u'i}, is multiplied by their user similarity, sim(u,u'). Such scores are summed up upon all similar users of u, and the result is normalized by the sum of user similarities. 

The final list of predicted item ratings for u is ranked and the top ranked items are served as recommendations to the query user.

If you want to dive deeper into the topic, here are a couple of useful links: