How I created a movie recommendation system? PRACTICAL

So have you ever thought of how Netflix works?

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?

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

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



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store