Introduction to Movie Recommendation System for Beginners

Divyesh Prajapati
5 min readJan 2, 2021

--

A recommendation system is the information filtering system. The function of recommeder system is to provide us the best matching information according to our requirement from a large set of information.

This article is based on a movie recommender system. It explains the both type of movie recommeder system, content-based and collaborative system.

If you are plan to implement it then, It can be created using python with Numpy, pandas, sklearn, and matplotlib, seaborn are used for data analysis purpose.

1 General Introduction

There are many different types of recommender systems to recommend hotels,clothing, food, songs, movies and so on. They all work on different scenarios but the main concept behind them all are same. So we choose the interesting one “Movie Recommender System”. We made movie recommender system using two approaches, content-based and collaborative system.We tried our best to cover up all concepts that was required.

1.1 Evolution in Recommender system

A Recommender System is a system that learns the attributes of users from given dataset provided and predict items and then recommend them the top items from system generated list. So we can say that recommender system is personalized to particular users to recommend them.

Personalization is something that people have done manually for a long time. If you go to a store to buy something, every shop has personal shopkeeper which knows what to offer particular customers and he helps to find the thing that you want. So indirectly you provide dataset containing your attributes and the shopkeeper recommend the things.

If you are looking for other forms of personalization, you can hire agents who will help you to find the things. A travel agent who knows that you’re interested in a safari will keep his eyes on trip related to it. So we can say that idea of manual personalization is not new !

1.2 Need Analysis

A Recommender System is a system that learns the attributes of users from given dataset provided and predict items and then recommend them the top items from system generated list.

One of the biggest reason why we need recommender system is that in modern times, with the help of internet we have too much options available for every single thing !

Suppose if you feel hungry and you have to order some food then, you open food delivery application, and you get confused about which one to order. Same thing will happen with us in most situations like buying clothes , home appliances, electronic appliances etc. Similar things will happen while selecting online services like which movie to watch ,Which songs to play, Which vehicle to ride etc.

In old days situation were different at that time only limited options available for every thing. But now we have too many ! So we need a system that help us to choose the best suitable options for us which matches our requirements. Recommender system fulfil this requirement.

2. Types of Movie Recommender System

There are mainly three types of movie recommender

(1)content-based

(2)collaborative recommender system

(3)Hybrid recommender system

3.1 Content-based

Content-based and collaborative system

In a content-based recommender system, we only recommend movies on the basis of users' past watching history. For this, we use the concept of a similarity matrix.

We make a similarity matrix with NLTK (natural language processing toolkit). In which extract keywords from the plot, genre, director’s name, and actor’s name. The picture below shows the head of the list of movies with the keywords which we extract with the help of NLTK.

An extracted word from the plot, genre, director’s name, and actor’s name

From this, we build a similarity matrix with “sklearn cosine_similarity”.

Similarity Matrix for movies

Here we can see that if there are total M no. of movies then the size of our matrix in M*M and particular value at index (i,j) Shows the similarity between those movies at the ith row and jth column. So if one user watches movie M1, then we recommend movies that are more similar to M1 on the basis of the similarity matrix.

3.2 Collaborative Recommender system

Collaborative System

In collaborative we have to predict the ratings of those movies which the user not rated and on the basis of that, we recommend movies.

So we can say that in the content-based system we only recommend on the basis of that user’s personal interest, but in the collaborative system, we recommend on the basis of whole mass interest.

As this method is based on mass users, there are lots of variation in their interests. for example, some user may like action movies and romance movie, while other may like action and animation movie.

we have to predict the movie which the user doesn’t yet rate and watch for the movie-user matrix given below, we have to predict the ratings of a question mark. see the below figure taken from Andrew NG’s Machine Learning Course.

Movie rating matrix

To solve this problem, we take some no. of features for both users and movies. suppose we take n features, total movie are m, and total users are u then..

Size of movie matrix M=m*n

Size of user matrix U=u*n

We can get the user-movie matrix from (M*(U transpose))

So our main goal is to develop such movie matrix M and user matrix U so that they give as much as the accurate value of the movie-user movie matrix. we use a gradient descent algorithm to get such matrix M and U.

Hope this helps you understanding the intubation behind building a movie recommendation system and if you are plan to make one then I strongly recommended you to just go through the “movie recommendation” week of Andrew NG’e machine learning course !

--

--

Divyesh Prajapati

Competitive Programmer | Codeforces -1850(Expert) | Final year Student at Institute of Technology, Nirma University