Recommendation models: what they are, how they work and how to choose one
Collaborative filtering, content-based filtering and hybrid models: the approaches behind the suggestions on platforms such as Netflix, YouTube and Amazon.
Online platforms collect thousands of customer interactions per minute, and recommendation models turn that data into personalized suggestions. This article explains what recommendation models are, what they are for, how collaborative filtering, content-based filtering and hybrid models work, and how to evaluate their results.
TABLA DE CONTENIDOS
Recommendation models are what platforms such as Netflix, YouTube and Amazon use to suggest what each user should watch or buy. This article explains what they are, what they are for and their main approaches (collaborative filtering, content-based filtering and hybrid models), plus reinforcement learning and the ways to evaluate results.
Why analyze customer data
We live in a more connected world, where online transactions outnumber traditional ones and information grows exponentially. This way of interacting means our data is stored, ready to be analyzed and put to use. It is no accident that data is often called the oil of the 21st century.
But what is the point of analyzing data? First, we need to answer three questions found in every strategy: what, how and when.
- When we analyze the what, we set a goal; for example, increasing sales.
- When we analyze the how, we decide the way we will get there; for example, by analyzing our customers’ data.
- When we analyze the when, we set a time period.
Getting value from data belongs to the second question, the how. We have more and more data about our customers: many companies run a platform where people buy, or deliver their service directly through it. Well-known examples include Netflix, YouTube and Amazon, among many others.
What do these companies have in common? The way they use data. They recognize the potential in their hands: hundreds of thousands of customer interactions within minutes. This is where recommendation models, the subject of this article, come in.
What recommendation models are and what they are for
The first question is: what are recommendation models? They are tools that generate recommendations about a given object of study based on the preferences and opinions of different users.
The second question is: why recommend? There are many possible answers, including:
- Helping users find their best choice, saving them time and personalizing their experience.
- Supporting marketing strategy and campaigns, with better knowledge of customer preferences and a more personalized relationship with each customer.
Some examples of recommendations: “Because you watched…”, “Other users watched…”, “Because we think you might like…”.
Which recommendation models exist? There are three main branches: collaborative filtering, content-based filtering and hybrid models.
Collaborative filtering
There are several collaborative filtering techniques. Some of them are described below.
Association rules
Association rules look for relationships between products. This group includes market basket analysis, which studies the products that appear together in the same purchase. For example:
- Customer 1 bought milk, eggs, sugar and bread.
- Customer 2 bought milk, eggs, cereal and bread.
- Customer 3 bought eggs and sugar.
Customer 3 would likely be interested in buying milk.
Alternating least squares (ALS)
The alternating least squares (ALS) algorithm factors the matrix of user-item interactions into latent factors and, from them, finds collaborative relationships between users and between items. It can work with two types of user feedback:
- Explicit: ratings, stated preferences and the like.
- Implicit: visits, clicks and the like.

Content-based filtering
This model recommends content (shows, for example) similar to what the user has already liked, on the assumption that the user may be interested in it too.
There are several ways to calculate the similarity between pieces of content. Common distance measures include:
- Euclidean: measures the straight-line distance between two objects.
- Manhattan: adds up the differences along each dimension, as if you could only travel along the streets of a grid.
- Cosine: compares the direction (angle) of two objects.
- Mahalanobis: improves on Euclidean distance by taking the covariance between variables into account.

Collaborative vs. content-based filtering

The difference between the two models lies in how the recommendation is found. Content-based filtering looks for similarity between pieces of content; for example, between articles on a news site, so the algorithm offers you articles you have not read that are similar to the ones you did read. Collaborative filtering looks for similarity between users; for example, two users who read the same article on a news site are considered similar. The more articles they have read in common, the greater the similarity and the more accurate the recommendation the algorithm will offer you.
Hybrid models
There are several ways to design a hybrid model. The goal is to combine two or more models to get a better one. For example, collaborative and content-based filtering can be combined to reach a single recommendation. There is no single way to build a hybrid recommender: imagination, together with trial and error, plays a central role.

According to Burke (2002), there are seven strategies for building a hybrid model:
| Strategy | How it combines models |
|---|---|
| Weighted | Combines the scores of several recommenders with different weights. |
| Switching | Picks one recommender or another depending on the situation. |
| Mixed | Shows recommendations from several recommenders together. |
| Feature combination | Uses data from one approach as extra features for another algorithm. |
| Cascade | One recommender refines the recommendations produced by another. |
| Feature augmentation | The output of one model becomes an input to the next. |
| Meta-level | The model learned by one recommender is used as the input of another. |
In many published examples, the best performance comes from a hybrid model, that is, from combining the models above; even so, which approach works best depends on each case.
Reinforcement learning and how to evaluate results
One approach falls outside traditional recommender systems: reinforcement learning. Although the concept is old, it has gained ground in this field. The problem can be framed with the content as the state, the action as the next best content to recommend, and the reward as the user’s satisfaction, conversion or rating.
Finally, we have the models, but which one is best? Answering that means going to the specific case and analyzing the results, with data science methods such as:
- A/B testing.
- Confusion matrix.
- Precision and recall.
- F1 score.
As time goes by and our information grows, companies that apply business analytics to their customer data will know us as well as our own family does.
If you want to go deeper, Quanam held a meetup on the subject, Recommending recommenders, available on its YouTube channel.
Gonzalo Acosta
Data & Analytics Consultant
This article was written with the participation of Gonzalo Herrera and Fernando López Bello, both consultants in Quanam’s Data & Analytics unit at the time of publication.