Build Recommender System – Part 1. Have you ever encountered the following cases?
- Your parents have just used Facebook and have just made friends with some of your family members. However, a few days later, Facebook suggested to your relative folks that even you don’t know?
- You are walking on an e-commerce site with the original purpose of finding a pair of men’s jeans. Then a series of products related to men’s fashion are suggested for you who are backpacks, bags, belts …. and after a while wandering on it you realize that you have been swept with the products. Sometimes forget about the purpose here to do?
- A gloomy weekend, you want to relax more by listening to a pop song in the mood, and you open YouTube and search for a pop song, lie down on the bed and enjoy the music, the next song Follow will be automatically suggested by Youtube and of course it rarely suggests a rock song for you while you are listening to pop music right?
All you have seen has one thing in common: our system is able to search for and suggest things that we might like but have not thought about, or have not known about it in time. That is the job of Recommender System – one of the pretty good problems applied in the field of Artificial Intelligence. And if you are curious about the above questions, this article will be for you.
What is the recommender system?
In essence, we can consider a recommender system like a matchmaker. It predicts our interests and looks for potential objects that fit that interest to suggest to us. Suppose you are single, you like pretty girls. But imagine that, people are limited and you absolutely cannot know all the beauties in the world. Now you really need a suggestion system like a match for you. It’s a little easier to understand, isn’t it, now we’ll come back to an example that applies in a fairly close field, e-commerce.
The image above helps you somehow figure out the problem. When you buy a product, the recommender system will do the job of offering similar products that you may like to buy. This really becomes a special assistant for consumers as well as sellers. Specifically, the way Amazon – the world’s famous e-commerce site, did the following:
- Pay attention to what customers love about their products based on their past data such as the rating on each product, the time to browse on each product, the number of clicks on the product …
- From then on, it is possible to predict which products other users will like and give them appropriate suggestions
It’s quite easy to understand, right. So what kind of basic components does a suggested system include, and how to build a recommender system? We will continue to find out
The basic components of build recommender system
As we know, to work or build a new information system, we need to figure out what components we will need to create them. Simply great things are built from small things, right … If we mentioned a system that suggested Machine Learning approach, then we need to consider three characteristics. Basic as follows
- First: The first thing to care about is the user, obviously, if there is no user, we know who to suggest.
- Second: We need to pay attention to items. These items can be products on sales pages, songs on music sites. Why need to care about items. Because without items, we don’t have anything to suggest to users. Are you right?
- Third: We need to pay attention to the feedback of each user on that item. It can be an evaluation point, which can be an indicator of the user’s interest in the item …. Simply because we have to quantify these quantities to be able to have a suggestive basis The idea for the user is not it
Perform information with the users – items matrix – Build Recommender System
After we have gathered the above information of the system in some way we need to express that information in a computable form. A great idea is to use a matrix, a created matrix representing each user’s liking to the corresponding item is represented as follows:
In the matrix there are weighted cells that will show each user’s favorite level on the items. On the other hand, there are also empty boxes showing the user has never had access to the item. This represents the role of a suggested system, which is based on the user’s known past information, the suggestion system will suggest to the user the information that the user does not know. That is to predict the values in the empty cells in the above matrix and then arrange the descending order to suggest to the user.
Classify Recommender system
Let us imagine two situations as follows:
- When we go shopping on an e-commerce site, we are looking at the selection of men’s T-shirts, the system will give us suggestions for similar items of men’s T-shirts. Looking for. Going to a music site, you join a channel of revolutionary music lovers and the system will suggest you the revolutionary songs that channel members often listen to.
These two situations are the two types of suggestion systems:
- Content based recommender systems: the system will take care of the content and characteristics of the current item and then suggest to users the same items. That is the first case
- Collaborative filtering recommender systems: is the system that will analyze users with the same rating, purchase existing items. Then find a list of other items that are also evaluated by these users, ratings and suggestions for users. The idea of this method is based on the similarity of preferences among users to make suggestions.
So which method should we use???
One thing is easy to see, the content-based suggestion method requires us to gather a lot of information about similar items. It is the determination of which item of information is similar to the current item that requires us to collect and analyze, process all items in the database. However, with the filter method, we do not need too much information. Simply the item_id of the current item, the user_id and the item’s feedback only should in fact be used for collaborative filtering to build suggestion systems.
Steps to do to build Recommender system
1. Data collection
If we simply care about the user rating for the item then the problem becomes quite simple, our data is already available in the DB. However, depending on the specific problem, our indicators are not always our walls and are available and therefore we need to have a plan to collect indicators that show this relationship first. when we are going to build a suggestion system. Some indicators can be used to replace rating points as follows:
- Number of clicks on the item
- Average time for item manipulation
After the collection process we have a lot of data in different sessions corresponding to the different actions of a user for the item. After processing with mathematical processing, we will get a unique index between a user-item pair. The next thing to do is Normalized the data
2. Normalized data
Our data matrix is mainly sparse matrix, which means that the amount of blank data is very much, so we need to Normalize this data stack to apply machine learning algorithms on it. OK. After Normalizing the data, we will build the machine learning model to calculate the similarity between users. I will talk about this section in the next article
3. Run the model, filter out top N items
After selecting the appropriate model we will proceed to run that model and select the top N items used to suggest to the user.
4. Evaluate model
As with other machine math problems, we also need to evaluate the model based on the test data set. However, due to the characteristics of the problem, there are different assessment methods. Since the scope of the article is too long, I don’t present it here. See you in the next article
Through this article, I hope you have partly understood the most general way about the recommender system. When implementing the model in practice, it is necessary to pay attention to some other characteristics as follows:
- Add some rules to choose the top N items that are more suitable for each user.
- Do not show products that have been purchased in the suggestion list.
- There is a plan to update the model through a new data set born daily.
You can read about Start NLP with Python