A quick look at Recommendation Systems

Photo by Dollar Gill on Unsplash

No matter how much we are not aware of the recommendation systems in our daily life, they are services that are almost instant and can direct us when necessary. However, recommendation systems are basically created to predict what users might like, what they need and present them to users when there are many options available.

When there are too many options, they quickly present them to the user by running in the background and indexing them, rather than processing them and keeping the user waiting.

Although creating a simple recommendation system is thought to be quite simple, the difficult part of this is to establish a suggestion system that is logical, can affect the user, and can add value / earn money thanks to this service. For example, why are all recommendation system instances always giving Amazon, Google, Netflix or Spotify? Because the investment made by these companies in this business is so consistent that while increasing the quality of the service they provide, it also provides them with a return.

Recommendation systems cover a wide range of fields and can be created using a variety of techniques, from simple to highly complex. While complex recommendation systems can be created with different techniques (eg deep learning, using unstructured data, etc.). As such, they are well suited for the artificial intelligence world and more specifically for unsupervised learning; However, we can do these operations to a certain extent in a rule-based manner. As users continue to consume content and provide more data, these systems can be built to provide better and better recommendations.

Now that we have an introduction to a short topic, let’s look at the basic recommendation systems:

  • Simple recommendations
    - General recommendations made with business knowledge or simple techniques.
    - The top-rated categories of the category are systems based on recommending bestsellers or trending ones.
  • Association Rule Learning
  • Content-Based (Filtering)
    - Neighborhood Methods
    - Correlation, Distance, etc...
    - To recommend from users who generally have similar preferences.
  • Collaborative Filtering
    - User-Based
    - Item-Based
  • and maybe the Hybrit Advice System.

These systems can work very useful depending on their location, but it would not be wrong to say that the most important two are Content-Based and Collaborative Filtering. Therefore, a detailed explanation for these two species would be more helpful.


Content-based systems also make recommendations based on the user’s history, and often the success rate is poor if there is not enough data for the user. However, as the amount of data belonging to the user increases, the system's success increases. We can divide content-based systems into 4:

  • By Content:
    It is the best-known and most basic contextual recommendation system. It focuses on suggesting content, similar to the previously preferred product or ingredient. However, for this, the product/service must be in a structure that contains content information.
  • Popular Content:
    It aims to highlight the product by using its special features in order to make the product/service attractive to a wide audience by using its popularity. It can be built with attributes like hype, price, feature, and popularity. This is generally preferred for new content.
  • Latent (Hidden) Factor Modeling:
    Unlike the content similarity approach, it tries to reveal the user’s personal interests, habits, and shopping style and reveal information focused on individual characteristics. For this, the user’s information must be obtained from different angles.
  • Subject Modeling:
    Basically, this modeling is a focused version of Hidden Factor Modeling for a specific purpose. Interests can be extracted by analyzing unstructured text to identify certain characteristics of the user. For example, reviewing reviews/comments instead of looking at the service/product purchase history.

Collaborative Filtering

It is a filtering suggestion based on similar actions of different people with characteristics in their own history.

  • User-Based Filtering:
    This strategy involves comparing users’ backgrounds and grouping similar users. By grouping, the target audience is assigned to the recipient and a suggestion is made, but it is helpful to quickly give advice to a user with little information about it.
  • Item-Based Filtering:
    This strategy, in which we look at items rather than users, aims to make a grouping of items. In other words, suggestions are made to the potential user among the groups created among the products in that group.

We can also make hybrid modeling by mixing these two methods. I will try to show this in the sample project.

If you want to access the project repo, you can click here.

Case Study & Descriptions

For Case, I used MovieLens 20M Dataset dataset available in Kaggle.

First of all, let’s look at our datasets, we have 2 data sets, one shows the movies, and the other shows the ratings. As a first step, I merge these two datasets.

1. User Based

Later, I remove the year portion in the titles, and then I simplify the data frame if the number of votes on a movie is less than 1000, as it will be rare for me and may affect my future transactions.

Then I choose a random user to make suggestions.

I find the movies watched by the randomly selected user.

I am trying to access the IDs of the users who watched the same movies. I wanted to have a logical association between the users I have and the randomly selected user by setting a certain limit here. So I save ids of users who watched at least 60% of these 186 movies.

I looked at the correlation between the users to be recommended and the most similar users, and I gathered the data of the user I selected and other users.

I found the most similar users by sorting the correlations I received in descending order.

By creating a data frame called top_users_ratings, I kept the users, correlations, and ratings. Then I created a variable named weighted_rating using correlation with Rating.

From this data frame I created, I made a movie recommendation over the top 5 people.

2. Item Based

Unlike the previous steps, I will make an item-based recommendation this time. That’s why I’m importing my datasets again.

Then I edit the content of the Genre variable, and finally, I adapt the type of timestamp to the process I’m going to do.

I find the id of the movie with the most up-to-date rating among the films that the recommended user has given 5 points, with the change of the year. Later, I printed out the movies belonging to these IDs.

3. Hybrid Recommendation

By combining the outputs we get from item-based and user-based, we can recommend these 10 movies under the name of hybrid recommendation.


  1. https://developers.google.com/machine-learning/recommendation
  2. https://www.sciencedirect.com/science/article/pii/S1110866515000341
  3. https://www.veribilimiokulu.com/

I’m a Master Student🎓pursuing Data Analytics. I’m a Data Enthusiast 💻 😃 passionate about learning and working with new tech. https://github.com/ogulcanertunc