Search code, repositories, users, issues, pull requests...

Provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .


Here are 121 public repositories matching this topic..., kishan0725 / ajax-movie-recommendation-system-with-sentiment-analysis.

A content-based recommender system that recommends movies similar to the movie the user likes and analyses the sentiments of the reviews given by the user

  • Updated Oct 30, 2023
  • Jupyter Notebook

kishan0725 / The-Movie-Cinema

The Movie Database for all language movies

  • Updated Jun 16, 2023

asif536 / Movie-Recommender-System

Basic Movie Recommendation Web Application using user-item collaborative filtering.

  • Updated Jul 18, 2022

jalajthanaki / Movie_recommendation_engine

This repository contains the code for building movie recommendation engine.

  • Updated Mar 27, 2018

kishan0725 / Movie-Recommendation-System-with-Sentiment-Analysis

Content based movie recommendation system with sentiment analysis

  • Updated May 1, 2023

rajaprerak / movie_recommender

Movie Recommender System with Django.

  • Updated Nov 22, 2022

rudrajikadra / Movie-Recommendation-System-Using-Python-and-Pandas

This is a python project where using Pandas library we will find correlation and give the best recommendation for movies.

  • Updated Jun 6, 2020

Sundar0989 / Movie_Bot

  • Updated May 4, 2020

MartinKondor / MovieRecommender

🎥 Movie Recommender AI System

  • Updated Aug 23, 2022

kashishahuja2002 / Next-Up-Microsoft-Intern-Engage

Next-up, a movie recommendation system project created for Microsoft Intern Engage' 2022. I got selected for Software Engineering Internship '23 at Microsoft via this program.

  • Updated Mar 10, 2023

Rpita623 / Movie-Recommendation-System-using-R_Project

Movie Recommendation System: Project using R and Machine learning

  • Updated Nov 4, 2021

Spidy20 / Movie_Recommender_App

It is a movie recommender web application which is developed using the Python.

  • Updated Jun 25, 2023

sileod / language-model-recommendation

Resources accompanying the "Zero-Shot Recommendation as Language Modeling" paper (ECIR2022)

  • Updated May 25, 2023

hu-guanwei / Movie-Recommender


  • Updated Apr 24, 2019

BeautifulBeer / Youflix

Movie recommendation system based on hybrid recommender and clustering

  • Updated Jan 4, 2023

nikita9604 / Movie-Recommendation-Website

Movie Recommendation System created using Collaborative Filtering (Website) and Content based Filtering (Jupyter Notebook)

  • Updated Oct 9, 2022

Chaitanyakaul97 / movie-recommendation-system

  • Updated Jun 3, 2020

Prajwal10031999 / Movie-Recommendation-System-Using-Cosine-Similarity

A machine learning model to recommend movies & tv series

  • Updated Oct 26, 2020

RohanKaran / MovieBuzz

It is a content based movie recommendations web app. Based on the user input, it recommends similar movies/webseries to the user using machine learning.

nano-bot01 / Movie-Recommender-Web-Application

Movie Recommendation System based on machine learning concepts

  • Updated Sep 21, 2023

Improve this page

Add a description, image, and links to the movie-recommendation-system topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the movie-recommendation-system topic, visit your repo's landing page and select "manage topics."

How to Build a Movie Recommendation System Based on Collaborative Filtering

In today’s world of technology, we get more recommendations from Artificial Intelligence models than from our friends.

Surprised? Think of the content you see and the apps you use daily. We get product recommendations on Amazon, clothing recommendations on Myntra, and movie suggestions on Netflix based on our past preferences, purchases, and so on.

Have you ever wondered what’s under the hood? The answer is machine learning-powered Recommender systems. Recommender systems are machine learning algorithms developed using historical data and social media information to find products personalized to our preferences.

In this article, I’ll walk you through the different types of ML methods for building a recommendation system and focus on the collaborative filtering method . We will obtain a sample dataset and create a collaborative filtering recommender system step by step.

Make sure to grab a cup of cappuccino (or whatever is your beverage of choice) and get ready!


Before we embark on this journey, you should have a basic understanding of machine learning concepts and familiarity with Python programming. Knowledge of data processing and experience with libraries like Pandas, NumPy, and Scikit-learn will also be beneficial.

If you're new to these topics, you can check out the Introduction to Data Science course on Hyperskill, where I contribute as an expert.

Different Types of Recommendation Systems

You'll probably agree that there is more than one way to decide what to suggest or recommend when a friend asks our opinion. This applies to AI, too!

In machine learning, two primary methods of building recommendation engines are Content-based and Collaborative filtering methods.

When using the content-based filter method, the suggested products or items are based on what you liked or purchased. This method feeds the machine learning model with historical data such as customer search history, purchase records, and items in their wishlists. The model finds other products that share features similar to your past preferences.

Let’s understand this better with an example of a movie recommendation. Let’s say you saw Inception and gave it a five-star rating. Finding movies of similar themes and genres, like Interstellar and Matrix, and recommending them is called content-based filtering.

Imagine if all the recommendation systems just suggested things based on what you have seen. How would you discover new genres and movies? That’s where the Collaborative filtering method comes in. So what is it? Rather than finding similar content, the Collaborative filtering method finds other users and customers similar to you and recommends their choices. The algorithm doesn’t consider the product features as in the case of content-based filtering.

To understand how it works, let’s go back to our example of movie recommendations. The system looks at the movies you've enjoyed and finds other users who liked the same movies. Then, it sees what else these similar users enjoyed and suggests those movies to you.

For example, if you and a friend both love The Shawshank Redemption, and your friend also loves Forrest Gump, the system will recommend Forrest Gump to you, thinking you might share your friend's taste.

In the upcoming sections, I’ll show you how to build a movie recommendation engine using Python based on collaborative filtering.


How to Prepare and Process the Movies Dataset

The first step of any machine learning project is collecting and preparing the data. As our goal is to build a movie recommendation engine, I have chosen a movie rating dataset. The dataset is publicly available for free on Kaggle .

The dataset has two main files in the format of CSV:

  • Ratings.csv : Contains the rating given by each user to each movie they watched
  • Movies_metadata.csv : Contains information on genre, budget, release date, revenue, and so on for all the movies in the dataset.

Let’s first import the Python packages needed to read the CSV files.

Next, read the Ratings file into Pandas dataframes and look at the columns.


The UserId column has the unique ID for every customer, and movieId has the unique identification number for every movie. The rating column contains the rating given by the particular user to the movie out of 5. The timestamp column can be dropped, as we won’t need it for our analysis.

Next, let’s read the movie metadata information into a dataframe. Let’s keep only the relevant columns of Movie Title and genre for each MovieID.


Next, combine these dataframes on the common column movieID .

This dataset can be used for Exploratory Data Analysis. You can find the movie with the top number of ratings, the best rating, and so on. Try it out to better grasp the data you are dealing with.

How to Build the User-Item Matrix

Now that our dataset is ready, let's focus on how collaborative-based filtering works. The machine learning algorithm aims to discover user preference patterns used to make recommendations.

One common approach is to use a user-item matrix . It involves a large spreadsheet where users are listed on one side and movies on the other. Each cell in the spreadsheet shows if a user likes a particular movie. The system then uses various algorithms to analyze this matrix, find patterns, and generate recommendations.

This matrix leads us to one of the advantages of collaborative filtering: it's excellent at discovering new and unexpected recommendations. Since it's based on user behavior, it can suggest a movie you might never have considered but will probably like.

Let’s create a user-movie rating matrix for our dataset. You can do this using the built-in pivot function of a Pandas dataframe, as shown below. We also use the fillna() method to impute missing or null values with 0.

Here’s our output matrix:


Sometimes, the matrix can be sparse. Sparsity refers to null values. It could significantly increase the amount of computation resources needed. Compressing the sparse matrixes using the scipy Python package is recommended when working with a large dataset.

How to Define and Train the Model

You can use multiple machine learning algorithms for collaborative filtering, like K-nearest neighbors (KNN) and SVD . I’ll be using a KNN model here.

KNN is super straightforward. Picture a giant, colorful board with dots representing different items (like movies). Each dot is close to others that are similar. When you ask KNN for recommendations, it finds the spot of your favorite item on this board and then looks around to see the nearest dots—these are your recommendations.

Now, the metric parameter in KNN is crucial. It's like the ruler the system uses to measure the distance between these dots. The metric used here is Cosine similarity.

What is cosine similarity?

It is a metric that measures how similar two entities are (like documents or vectors in a multi-dimensional space), irrespective of size. Cosine similarity is widely used in NLP to find similar context words. Follow the snippet below to define a KNN model, the metric, and other parameters. The model is fit on the user-item matrix created in the previous section.

Next, let's define a function to provide the desired number of movie recommendations, given a movie title as input. The code below finds the closest neighbor data, and points to the input movie name using the KNN algorithm. The input parameters for the function are:

  • n_recs : Controls the number of final recommendations that we would get as output
  • Movie_name : Input movie name, based on which we find new recommendations
  • Matrix : The User-Movie Rating matrix

How to Get Recommendations from the Model

Let's call our defined function to get movie recommendations. For instance, we can obtain a list of the top 10 recommended movies for someone who is a fan of Batman.


Hurray! We have got the result we needed.

Advantages and Limitations of Collaborative Filtering

The advantages of this method include:

  • Personalized Recommendations: Offers tailored suggestions based on user behavior, leading to highly customized experiences.
  • Diverse Content Discovery: Capable of recommending a wide range of items, helping users discover content they might not find on their own. It gives diverse content discovery the edge over content-based filtering.
  • Community Wisdom: Leverages the collective preferences of users, often leading to more accurate recommendations than individual or content-based analysis alone.
  • Dynamic Adaptation: The model continuously gets updated with user interactions, keeping the recommendations relevant and up-to-date.

It’s not all sunshine, though. One big challenge is the cold start problem. For example, this happens when new movies or users are added to the system. The system struggles to make accurate recommendations since there's not enough data on these new entries.

Another issue is popularity bias. Popular movies get recommended a lot, overshadowing lesser-known gems. There are also scalability issues that come with managing such a large dataset.

While developing collaborative filtering-based engines, computational expenses and data sparsity must be kept in mind for an efficient process. It’s also recommended to take action to ensure data privacy and security.

Using Collaborative Filtering to build a movie recommendation system significantly advances digital content personalization. This system reflects our preferences and exposes us to a broader range of choices based on similar users' tastes.

Despite its challenges, such as the cold start problem and popularity bias, the benefits of personalized recommendations make it a powerful tool in the machine learning industry. As technology advances, these systems will become even more sophisticated, offering refined and enjoyable user experiences in the digital world.

Thank you for reading! I'm Jess, and I'm an expert at Hyperskill. You can check out an Introduction to Data Science course on the platform.

👩‍💻 Software developer from Boston

If this article was helpful, share it .

Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started

DEV Community

DEV Community

Pavan Belagatti

Posted on Sep 22

Let's Build a Movie Recommendation App Using OpenAI & Python!

In today's digital age, personalization is key. Whether you're browsing an online store or searching for a movie to watch, tailored recommendations enhance user experience. In this tutorial, we'll embark on a journey to create a simple movie recommendation app using OpenAI, Python and SingleStore's Notebook feature. Harness the power of cutting-edge language models to provide movie suggestions based on user interests.

movie recommendation app

Let's Get Started!


  • Free SingleStore cloud account so you can access the Notebook feature
  • Python 3.x installed
  • OpenAI's API key. Where can you find your API Key? Here

We will be using SingleStore Notebook feature as our playground to execute all our commands inside. I'll show you how in the tutorial:)

What is SingleStore Notebooks?

Notebooks have become increasingly popular in the data science community as they provide an efficient way to explore, analyze and visualize data, making it easier to communicate insights and results. SingleStore's Notebook feature is based on the popular Jupyter Notebook , which is widely used in data science and machine learning communities.

One interesting fact about SingleStore Notebooks is that, they allow users to query SingleStore's distributed SQL database directly from within the notebook interface.

singlestore notebook

openai - to interface with OpenAI's API pandas - for data manipulation numpy - for numerical operations

First, you'll need to install the libraries if you haven't already:

Like I said above, we will add this command in our SingleStore Notebook's playground. Also, make sure you run the cell every time you add any new command in your Notebook.

Install numpy

1. Import Libraries

ss playground

2. Load Data

Let's load movie names

movies added

3. Initialize OpenAI API

Replace 'your-api-key-here' with your actual API key.

4. Map each movie to its category

[ Note : Make sure you run the cell when you map these movies to their respective categories]

movie genre

5. Let's ask our app to recommend some 'Drama' movies.

drama movies

6. Let's ask user input this time

user input movies

In wrapping up, we've journeyed through the simplicity and power of combining OpenAI with Python to craft a personalized movie recommendation engine. While our approach is straightforward, it offers a glimpse into the vast potential of AI-driven solutions in enhancing user experiences. With just a few lines of code, we've transformed a basic query into tailored movie suggestions.

If you are really interested in more such tutorials, I have the below ones for you to try.


Learn How to Build a LangChain Audio App with Python in Just 5 Minutes!

Pavan belagatti ・ sep 15, sentiment analysis using python: a beginner-friendly tutorial, pavan belagatti ・ sep 11, top comments (5).


Templates let you quickly answer FAQs or store snippets for re-use.

rajboruah profile image

  • Joined Sep 24, 2023

Thank you for writing this. Unfortunately, I did not notice anywhere you used openai in the program (other than importing openai and assigning the key to openai.api_key. I felt, this program will work without openai.

Please help in understanding the use of openai above. I hope, I am making mistake somewhere.

pavanbelagatti profile image

  • Joined Apr 22, 2018

You can see the 3rd point of initializing OpenAI API.

Yeah, I could see that and I meant that while saying in my previous comment: ' importing openai and assigning the key to openai.api_key '. But I am finding it hard to see where are you calling openai apis ? Also, where you using panda

proteusiq profile image

  • Location Copenhagen, Denmark
  • Education Aalborg University
  • Work 🐙 Principal Data Scientist @ NTT
  • Joined Dec 21, 2018

Did you intend to use the movie description or plot as embedding with OpenAI and using distance/similarity matrix or did you generate the genre with a prompt? As it is, OpenAI is not used and the code will work without it as it is dictionary value-to-key lookup.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink .

Hide child comments as well

For further actions, you may consider blocking this person and/or reporting abuse

daviduzondu profile image

How To Create a Before and After Image Slider With Vanilla JavaScript

David Uzondu - Dec 1

simongreennet profile image

Weekly Challenge 243

Simon Green - Nov 19

vladignatyev profile image

🤔 Python Quiz 4/64: Snake Comprehensions 🐍

Vladimir Ignatev - Dec 1

brunbs profile image

[Java Spring Boot] Como fazer seu endpoint retornar um arquivo CSV

Bruno Barbosa - Nov 21

Once suspended, pavanbelagatti will not be able to comment or publish posts until their suspension is removed.

Once unsuspended, pavanbelagatti will be able to comment and publish posts again.

Once unpublished, all posts by pavanbelagatti will become hidden and only accessible to themselves.

If pavanbelagatti is not suspended, they can still re-publish their posts from their dashboard.

Once unpublished, this post will become invisible to the public and only accessible to Pavan Belagatti.

They can still re-publish the post if they are not suspended.

Thanks for keeping DEV Community safe. Here is what you can do to flag pavanbelagatti:

pavanbelagatti consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy.

Unflagging pavanbelagatti will restore default visibility to their posts.

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.


  1. Movie Recommendation System Project In Python With Source Code

    movie recommendation engine python

  2. Movie-recommendation-system-with-Python/Recommender Systems.ipynb at master · alhewpl/Movie

    movie recommendation engine python

  3. How To Build a Recommendation Engine in Python

    movie recommendation engine python

  4. Movie Recommendation System Project Using Collaborative Filtering, Python Django, Machine

    movie recommendation engine python

  5. Building a Movie Recommendation Engine in Python using Scikit-Learn

    movie recommendation engine python

  6. Building a Movie Recommendation Engine in Python using Scikit-Learn

    movie recommendation engine python


  1. Recommendation Systems in Python?

  2. Python Developer

  3. I'm finally using Python in production (as a typescript developer)

  4. FASTEST Way to Become a Python Developer and ACTUALLY Get a Job

  5. How I Became a Python Developer My Journey and Message to People

  6. Building Recommender System in PHP8


  1. Sign In to Up Faith and Family for Personalized Recommendations

    Are you a fan of faith-based content and family-friendly entertainment? If so, you’ve probably heard of Up Faith and Family. This streaming service offers a wide range of uplifting movies, TV shows, and original content that aligns with you...

  2. What Is the Recommended Oil for Chrysler Vehicles?

    For the 2015 model year, Chrysler recommends that its cars use American Petroleum Institution certified oil with a viscosity grade of either 0W-20 or 5W-20, depending on the vehicle model and engine type.

  3. Common Mistakes to Avoid When Choosing the Recommended Oil for Your Car

    When it comes to maintaining your car’s engine, choosing the right oil is crucial. The recommended oil for your car plays a vital role in ensuring optimal performance and extending the lifespan of your vehicle.

  4. Python

    Let's focus on providing a basic recommendation system by suggesting items that are most similar to a particular item, in this case, movies. It

  5. movie-recommendation-system · GitHub Topics

    This is a python project where using Pandas library we will find correlation and give the best recommendation for movies. python recommendation-system movielens

  6. How to Build a Movie Recommendation System Based on

    Before we embark on this journey, you should have a basic understanding of machine learning concepts and familiarity with Python programming.

  7. Getting Started with a Movie Recommendation System

    Getting Started with a Movie Recommendation System. Python · TMDB 5000 Movie Dataset, The Movies Dataset · Copy & Edit 5503. arrow_drop_up 1772. gold medal

  8. Movies Recommendation System using Python

    We need a function to implement the recommendation system that takes the movie we are searching for as input and similar movie names as output.

  9. How Build A Movie Recommendation System Using Python

    Data Science Course for 3-8 Yrs Work Exp: Data Science Course for 0-3 Yrs Work Exp:

  10. Let's Build a Movie Recommendation App Using OpenAI & Python!

    In today's digital age, personalization is key. Whether you're browsing an online store or searching... Tagged with python, ai, beginners

  11. Movie Recommendation System With Python And Pandas

    In this project walkthrough, we'll learn how to create a movie recommendation system using Jupyter, Python, and Pandas.

  12. Building a Movie Recommendation System with Python

    A movie recommendation system is a type of recommender system that suggests movies to users based on their past ratings or viewing history.

  13. Create a Movie Recommendation Engine with Milvus and Python

    Recommender systems or recommendation engines are information-filtering systems that aim to predict and suggest things users might be

  14. Build a Movie Recommendation System in Python using Machine

    Our movie recommendation engine works by suggesting movies to the user based on the metadata information. The similarity between the movies is calculated and