Content Recommendation Systems with Machine Learning

Content recommendation systems have become very popular in recent years. Among the most widespread are the recommendations of products in online stores, movies, videos, music, books, products or profile recommendations to follow on social networks. In this article we analyze important aspects when selecting or implementing a recommendation system and the role of Machine Learning in this field.

What is a recommendation system?

A “recommender” is a system that selects a product that, if purchased, maximizes the value for both the buyer and the seller at a certain point in time. To make recommendations, the system analyzes and processes historical information of users (age, previous purchases, qualifications…), products or contents (brands, models, prices, similar contents …) and transforms it into actionable knowledge, that is, it predicts which product can be interesting for the user and for the company. The recommenders also have a certain level of autonomy when presenting the recommendations to the end user.

From a more technical point of view, recommenders are usually of two types: collaborative filters and content-based filters. In this context, a filter is the mathematical algorithm that “decides” which is the optimal recommendation based on the data that we give it.

Collaborative filters

Collaborative filters generally base their logic on user characteristics. The data held by the user becomes the center of a collaborative filter. The system analyzes the previous purchases, the preferences, the ratings given by other products, the average amount of purchases, etc. and look for other users who look like him and who have made similar decisions. The products that have been successful with similar users, will surely also interest the new user.

Filters based on content

Content-based filters have the product as the basis of the prediction, rather than the user. That is, it uses the characteristics of the article (brand, price, ratings, size, category, etc.) to make the recommendations.

Let’s see an example of a content-based filter that Machine Learning uses to make recommendations. Think of a recommendation system for a streaming music service. The “product” in this case would be the songs. The data that we have available for each song are for example the group, the singer, the record company and the genre (pop, rock, classical, soundtrack …). To further enrich the system, we will also assess the ratings that the user has done on the topics – explicit ratings, such as star ratings, or implied, such as the times you have heard the subject – as well as the user’s own characteristics (age, sex and country).

These data, focused on the product and seasoned with user data, will be the raw material of this recommendation system. Let’s see how the prediction is made. Machine Learning is a discipline that makes predictions based on questions to the data. The question that must be answered in this case is: this user to whom I have to make a recommendation and who has these characteristics, this behavior and who has previously qualified these songs, what rating would you give to this song, which belongs to group X, of the Y label and of the genre Rock? The response of the filter (which we have “trained” with the data of hundreds of thousands of system users) would give us a number between 0 and 10, based on the ratings given by other users that resemble it. The question must be repeated with all the songs that are included in the catalog of recommendations and the prediction of the qualifications of all of them will be obtained. Of all the answers, the songs that get the best score will be the ones presented to the user.

This is an approach to a recommendation system. There are others that can be assessed depending on the type of product being analyzed and the business objectives. In any case, beyond the type of filter and its design, there are important issues that must be taken into account.

Make sure you really need a recommender

If the product catalog is small or if you have few customers, you probably do not need a recommender. The profitability of a recommender grows exponentially as both the catalog and the number of clients grow.

The user experience is more important than the algorithm

Make sure the user sees the recommendations at the right time and place. Defining your location in advance is not something that can be generalized, each type of product has its needs. A web of videos like youtube offers recommendations mainly in three moments: when you access the main page, when you finish playing a video and in the area to the right of the player. On the other hand, in an e-commerce website, it can be more efficient to place them in the lower part of the product that is being viewed and at the end of the purchase process. The essential thing is that they show up in the navigation flow when the user finds it more useful to receive them. A / B testing is a good technique to make these types of decisions.

The recommendations must have a strategic sense

Is the best recommendation for a client also the best for the business? Not always. From the client’s point of view, a good recommendation is different than a useful recommendation. Often the recommendations that are most likely to be correct are too obvious to be useful. Sometimes it is better to make risky recommendations that offer unknown products to the client.

On the other hand, from the point of view of the business, it is necessary to make a balance between short-term profits and long-term returns. The business logic must be inserted in the recommendation system in order to adjust the values ​​to the business objectives. Having values ​​such as the profitability of the product as a decision parameter can be a starting point.

Balance data and algorithms appropriately

The quality and quantity of the data is more important than the algorithms. A good algorithm with poor quality data will also offer low quality recommendations. But good data, with sufficient volume and organized efficiently, will give us reasonably good recommendations even if the algorithm is not optimal.

The phase of data engineering, feature selection, categorization (what is called feature engineering in English) is a particularly important process in any project that involves a massive analysis of data to make predictions.

Measure everything

From the impressions or the rate of click (CTR), through the secondary actions, the efficiency in different types of devices, the average time of purchase, comparisons between users with and without recommendations, average price of the purchase, number of interactions totals, video viewing time, bounce rates, total number of reviewed articles … Everything.


A recommendation system is much more than an algorithm or a filter that selects products with more or less success. We can divide a recommender into 4 parts: the knowledge base (the information, the data), the processing of the knowledge base (technology, algorithms, filters), the analytics and business control (measuring everything, business strategy) and finally the user interface.

Evaluate your environment, your product, your business, the quality and quantity of your data, the behavior of your clients and build the recommender that best suits your needs.

Hope this post has been interesting for you and looking forward to your comments and recommendations!