How I created a movie recommendation system? PRACTICAL

Shubham Kumar Gupta
2 min readApr 4, 2021

--

So have you ever thought of how Netflix works?

Amazon product recommendations, Facebook friends, Linkedin connections

Hell lot of applications are there that can be used with this recommendation system.

Let's Decode this; (Reverse Order)

We need 50 movies related to a movie

so finally we need a list of 50 films like this =[“ Harry Potter”,” StartDust”,” Hobbit”,” Avengers”,…,” Mickey Mouse”]

Now we can say Harry Potter is related to Hobbit but very different from Mickey Mouse

So let's convert this into numbers(now random will be better later on😛)

Lets assume list of numbers say =[1,0.8,0.9,0.4,….,0.01]

where 0.9 is Hobbit and 1 is Harry Potter

So we can have a sorted list and we can directly say which movie is close to Harry Potter right?

Cool, Now Let’s hover on how to get these Numbers

This is known as similarity_score check

Text A: [“Apple Ball Apple”]

Text B: [“Ball Ball Apple”]

How much they’re similar?

Apple:2 Ball:1 P1(2,1)

Ball:2 Apple:1 P2(1,2)

Lets plot this

Now Let’s calculate euclidean distance sqrt((1–2)²+(2–1)²) = 1.414

This can be done using predefined function cosine_similarity function in sklearn

Let’s dive into coding now!

we will download a dataset movie_dataset.csv

https://drive.google.com/file/d/1CoosLdeiHjFDPmFgiBTGDJTClaSNZrNC/view?usp=sharing

Now let's read this csv using pandas and run the below code

This finally gives result as movies to recommend are:

Thank you Code Heroku

--

--

Shubham Kumar Gupta
Shubham Kumar Gupta

No responses yet