Code Monkey home page Code Monkey logo

movie-recommendation-system's Introduction

Movie Recommender System

This project is a content based recommender system which calculates the similarity matrix of 4805 movies in the TMDB database using cosine similarity. It then gives top 5 recommendations based on highest similarity scores (between -1 and 1)

Screenshot 2024-03-17 221235

Project link - Streamlit Cloud project

If the above link doesn't work, then please follow the instructions given below from here to setup the project in your system.

How the cosine similarity matrix was calculated:

  1. The 2 .csv files in the dataset were merged
  2. All important columns were retained
  3. Transformations using functions were performed to convert all column values to lists
  4. The columns were merged to create a "tags" column
  5. Transformations like lowercase, stemming, removing stopwords was done on the "tags" column
  6. Cosine similarity matrix was calculated and a "recommend_movie" function was created to recommend the movies

app.py workflow:

  1. A PyCharm project was created with a virtual environment
  2. movies.pkl and similarity.pkl files were generated from the .ipynb file itself and copied to the PyCharm project folder
  3. A profile was created on TMDB to generate an API key to fetch posters of recommended movies
  4. app.py was designed to fetch posters from TMDB and generate movie names
  5. Movie names and posters were displayed
  6. App was deployed to Streamlit Community Cloud

Instructions to run project locally:

  1. Clone the repository:

    git clone https://github.com/rohanrvpatil/movie-recommendation-system.git
  2. Install the required packages:

    pip install -r requirements.txt
  3. Get a TMDB API key from here and store it in .streamlit/secrets.toml:

    # .streamlit/secrets.toml
    [general]
    tmdb_api_key = "your_tmdb_api_key"
  4. Access the API key in your app.py:

    import streamlit as st
    
    tmdb_api_key = st.secrets["general"]["tmdb_api_key"]
    # Use the API key to fetch data from TMDB
  5. Run the Streamlit app:

    streamlit run app.py

Tip

Use VPN if the movie recommender system is not working. API requests to TMDB from certain countries don't work

Resources:

  1. TMDB 5000 Movie Dataset
  2. API key creation
  3. YouTube link of project

movie-recommendation-system's People

Contributors

rohanrvpatil avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.