4 Ways To Supercharge Your Recommendation System
By: Neil Chandarana
Tags: Machine Learning, Mathematics, Business, Data Science, Programming

Recommender systems help users find items they like. They do so by producing a predicted likeliness score or a list of top recommended items for a given user. Recommendations can be based on a plethora of factors including user demographics, overall item popularity and historical user preference. Real-life examples are encountered regularly in places such as Amazon, Spotify and Tinder.

However, many systems operate at a scale that stresses the challenges of successful academic and “small data” applications. Furthermore, increased user awareness and choice has led to preference promiscuity meaning users are happier than ever to drop a service that isn’t personally accurate.

With this in mind, the following 4 points are implementable ideas that target scalability issues whilst improving the quality of your collaborative filtering recommendations.

Credit: @BlaxZtar

1 — Ditch Your User-Based Collaborative Filtering Model.

A key challenge you will face with collaborative filtering algorithms in a business setting is tackling data sparsity and scalability. Modern systems demand the capability to process tens of millions of potential data points with a low tolerance for performance limitations. In these systems, users may have interacted with less than 1% of items available.

Bottlenecks in user-based collaborative filtering models largely arise in the search for neighbours, which are other users who have historically shown similar preferences to a given user, among large user populations. Capability to search thousands of neighbours is good but systems have to scale with the business they fit into — real value arises for both you and your user by being able to search millions of neighbours in real-time.

The switch to item-based collaborative filtering algorithm transposes the recommendation problem from user space to item space. It explores the relationship between items instead of the relationship between users. In most real-life applications, the number of items is dwarfed by the number of users and in many cases items are static. That is, the set of items changes much less frequently than the number of users. This allows for a decoupling of the fitting stage and prediction stage of an item based collaborative filtering model.

Let’s see the difference in practice.

Using a training set of 994,168 ratings on a set of 3,704 movies from 6,040 users (MovieLens 1M dataset), the computational cost of evaluating the similarity matrix for a user-based algorithm is 77.6 seconds but just 28.4 seconds for an item-based algorithm, each using Pearson similarity.

This switch addresses computational capability for large scale systems which at some stage becomes more important that minor differences in quality. Of course, the exception exists if your set of users is smaller than your set of items and is also expected to change relatively less frequently.

2 — A Gold Standard Similarity Computation Technique.

The concept of similarity is a critical element of the collaborative filtering framework. For user-based collaborative filtering algorithms, the user-similarity matrix consists of a metric that measures the distance between any pair of user preferences. Likewise, the item-similarity matrix measures the similarity between any pair of items in the item based framework. Three commonly discussed techniques are Pearson, Cosine and Mean Square Difference (MSD) but what similarity computation technique should you use?

Enter User 56. User 56 rated 54 movies of which the 5 star rated movies from the same training set above are given below.

Figure 1 — User 56’s Top Rated Movies

I picked user 56 purely out of interest in what recommendation arise given the user enjoyed both American History X and Babe (arguably two movies about pigs). Producing appropriate recommendations is a function of other users in the dataset however the ability to pick out those users is down to the choice of similarity metric.