How does Machine Learning pick what to recommend us?

Nowadays it is a common practice to suggest clients the products they can be interested in. Why companies are so willing to do it? It is about boosting profit because of showing clients more valuable for them content or products. For this reason, recommender systems are gaining popularity and are used in more and more applications.
This article covers a basic understanding of recommender systems, including mainly:
main types of recommender systems
when to use a particular type of recommendations
data used by recommender engine
Types of recommendations
We can distinguish 4 major types of recommender systems. They are presented below.

Popular items
The first type of recommender systems works on a basis of how popular an item is. It means that what you see in your recommendations are simply the items that are most popular. It is worth noting that the popularity can be measured at different levels. Items can be most popular globally or in your neighborhood, they can be most popular in the last week or in a longer period.
The basic assumption of this type of recommender systems is that the most popular items sell the best.
Content-based filtering
The second type of recommender systems is called content-based filtering. It consists of recommending items which are similar to products that you have already purchased, liked or viewed.
To demonstrate content-based filtering in practice let’s take a furniture store website as an example. Let’s say you want to buy a new wardrobe to your flat. You’re particularly interested in white color and big-size wardrobe. You used these filters while looking for your ideal wardrobe on a furniture store website. In this case, the recommender system will notice that you’re looking for light, fair-sized types of furniture and it will show you other wardrobes with similar attributes.
Collaborative filtering
The next recommender systems type is known as collaborative-filtering and the main idea is to suggest products that were bought, liked or in another way positively interacted by users who have similar tastes or preferences to the user in question. Its assumption is — similar users purchase similar products.
Let’s illustrate this recommender system type as an example. Looking at the interaction matrix below we can see that user A and user C have similar tastes. They both like product 1, product 6 and dislike product 5. Noting this similarity we can assume that user C will also likes other products which have been enjoyed by user A (and vice-versa). That’s why the recommender system, based on looking for similar users, will decide to recommend product 3 — product liked by user A — to user C

The technique presented in the example above is called user-user or user-based collaborative filtering. It is used to find users with the most similar interactions. It can be interpreted as ‘Users who are similar to you also liked…’.
The second approach used in collaborative filtering is known as item-item or item-based collaborative filtering and its goal is to identify items that are similar to the one which has been already bought, liked or in a different way positively interacted by a user. This approach can be illustrated as ‘Users who liked this item, also liked …’
In collaborative filtering, we can distinguish 2 methods – memory-based and model-based algorithms. In memory-based approach we use only information from an interaction matrix, without creating any model, to produce recommendations. On the other hand, in model-based filtering we allow a model to discover useful features and create user and item representations based on an interaction matrix. It means that we use Machine Learning models to predict users’ ratings of items.
Hybrid approach
Last, but not least, there is also a concept of combining collaborative filtering and content-based filtering algorithms. In this case, we can take advantage of both past users interactions/ratings, as well as items/users attributes.
When to use a particular type of recommendations?
Now, when you got to know common types of recommender systems let’s find out when each of them is used.
As you can guess, recommending popular products is the most general and unpersonalised type of recommendations. For this reason, they can be a perfect choice for showing recommendations on homepages of e-commerce sites or for newly registered on the website users we don’t know anything about.
When it comes to content-based filtering it can be worth using it on product pages in the online shop. For example, for a user viewing a chair it can be a good idea to present him alternatives —similar chairs to the currently viewed one. It is worth noting that two products can be similar not only because of their explicit attributes, but they can be similar also visually or have similar descriptions. In this case, we can use Computer Vision and Natural Language Processing to detect the similarity between products.
The next type of recommender systems, collaborative filtering, can work well as recommendations sent in newsletters as well as recommendations located in different places on online store’s website. As mentioned before, this kind of recommendations is based on users’ past behavior and therefore can be a good choice for a variety of applications.
Data used by recommender engines
User interactions
Now that we now what types of recommendations are commonly used let’s move to data used in recommender engines. Recommendation systems can work on real-time data (which means that new piece of data is provided directly to a recommender engine) or it can work in batches (which means that data is provided to a recommender engine at intervals and because of it with a delay) . When designing a recommender system it is a key-aspect to enable it to work on real-time data. Algorithms working on real-time data achieve the best results.
Explicit data
While discussing collaborative filtering, we used an example based on user’s rating. This kind of rating is known as explicit data and it is a direct users’ feedback about an item. It can be both binary choice, such as like or dislike (as presented in the example) as well as a rate, e.g., rating a purchased product on an e-commerce website on a scale from 1 to 6 stars.
Implicit Data
Except explicit rating, a recommender engine can also use implicit data which can be understood as past users' interactions. They involve not only past purchases, but also other kinds of user interactions. For e-commerce it could be adding a product to a cart, viewing a product, scrolling down to product details. On the other hand, for music/movie platforms the key interaction would be listening to a song or watching a movie. This kind of data is called an implicit rating.
Items and users attributes
Now that we know what kind of data can be provided to collaborative filtering model let’s move to content-based model. As we mentioned, in this case products attributes are used to create recommendations. Example of products attributes can be some basic pieces of information like product category or product color, but also images of products (we can recommend items with similar look) or product descriptions (we can use Natural Language Processing to extract tags from products descriptions). Furthermore, in content-based filtering also users' features can be used. An example of it can be users' age, gender or country of residence.
Conclusion
The article was the 1st post of the series about recommender systems. Today we covered basic topics, including their types, usage and necessary data. In the next blog we will discuss practical aspects of building a recommender system. Stay tuned!
Anna Kołacz
Junior Machine Learning Developer