Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฌ CineMatch | NLP-Powered Content-Based Movie Recommendation System

Python Flask Machine Learning Deployment

Built and deployed an NLP-powered movie recommendation engine using content-based filtering, processing 4,800+ movies and generating real-time recommendations through a Flask REST API integrated with OMDB.


๐Ÿ“Œ Overview

CineMatch is an NLP-powered content-based movie recommendation system that recommends movies based on their content rather than user watch history. By analyzing movie overviews, genres, keywords, cast members, and directors, the system identifies similar movies and provides highly relevant recommendations.

The recommendation engine leverages Natural Language Processing (NLP), Bag-of-Words vectorization, and Cosine Similarity to process over 4,800 movies and generate recommendations in real time through a Flask-powered web application.

๐ŸŒ Live Demo: https://recommendation-system-1-gjc3.onrender.com


โœจ Features

  • ๐ŸŽฅ Content-Based Movie Recommendation Engine
  • ๐Ÿง  NLP-Powered Similarity Analysis
  • โšก Instant Top-5 Movie Recommendations
  • ๐Ÿ–ผ๏ธ Real-Time Movie Poster Retrieval using OMDB API
  • ๐ŸŒ™ Responsive Cinematic User Interface
  • ๐Ÿ”„ Flask REST API Backend
  • โ˜๏ธ Render Deployment
  • ๐Ÿ“ฑ Mobile-Friendly Design

๐Ÿ“ธ Screenshots

Home Page

Home Page

Recommendations

Recommendations


๐Ÿง  Machine Learning Pipeline

1. Data Preprocessing & Feature Engineering

The TMDB 5000 Movies Dataset was cleaned and transformed by extracting key features:

  • Movie Title
  • Overview
  • Genres
  • Keywords
  • Top 3 Cast Members
  • Director

These features were merged into a unified metadata field called tags, representing each movie's content profile.


2. Natural Language Processing (NLP)

Text Normalization

  • Converted text to lowercase
  • Removed inconsistencies across metadata

Stemming

Implemented using NLTK's Porter Stemmer.

Example:

acting, actor, acted โ†’ act

This reduces redundant vocabulary and improves feature representation.


3. Feature Extraction

Bag of Words Vectorization

Implemented using Scikit-Learn's CountVectorizer.

from sklearn.feature_extraction.text import CountVectorizer

cv = CountVectorizer(
    max_features=5000,
    stop_words='english'
)

Each movie is transformed into a vector in a 5000-dimensional feature space.


4. Recommendation Algorithm

Cosine Similarity

The recommendation engine measures similarity using cosine similarity.

Cosine Similarity = (A ยท B) / (||A|| ร— ||B||)

Interpretation:

  • 1.0 โ†’ Highly Similar
  • 0.0 โ†’ Completely Different

The system generates a similarity matrix of approximately:

4806 ร— 4806

allowing fast retrieval of the most similar movies.


๐Ÿ“Š Model Statistics

Metric Value
Movies Processed 4,806
Vocabulary Size 5,000 Features
Similarity Matrix 4,806 ร— 4,806
Recommendation Type Content-Based Filtering
Average Response Time < 1 Second

๐Ÿ› ๏ธ Tech Stack

Machine Learning & Data Science

  • Python
  • Pandas
  • NumPy
  • Scikit-Learn
  • NLTK

Backend

  • Flask
  • Gunicorn
  • Requests

Frontend

  • HTML5
  • CSS3
  • JavaScript
  • Tailwind CSS

Deployment

  • Render
  • GitHub
  • Git LFS

๐Ÿ”Œ API Documentation

Recommendation Endpoint

POST /api/recommend

Request

{
    "movie": "Avatar"
}

Response

{
    "recommendations": [
        {
            "title": "John Carter",
            "poster": "poster_url"
        },
        {
            "title": "Guardians of the Galaxy",
            "poster": "poster_url"
        }
    ]
}

๐Ÿ“‚ Project Structure

Movie-Recommendation-System/
โ”‚
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ movie_dict.pkl
โ”œโ”€โ”€ similarity.pkl
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ Procfile
โ”œโ”€โ”€ runtime.txt
โ”‚
โ”œโ”€โ”€ templates/
โ”‚   โ””โ”€โ”€ index.html
โ”‚
โ”œโ”€โ”€ Movie REcommendation System.ipynb
โ”‚   
โ”‚
โ””โ”€โ”€ README.md

๐Ÿ“Š Dataset

TMDB 5000 Movies Dataset

Source:

https://www.kaggle.com/datasets/tmdb/tmdb-movie-metadata

The dataset contains:

  • Movie Metadata
  • Genres
  • Keywords
  • Cast Information
  • Crew Information
  • Movie Overviews

โš™๏ธ Local Setup & Installation

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/Movie-Recommendation-System.git

cd Movie-Recommendation-System

2. Create Virtual Environment

python -m venv venv

Activate Environment

Windows

venv\Scripts\activate

Mac/Linux

source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment Variables

Create a .env file:

OMDB_API_KEY

Get a free API key from:

https://www.omdbapi.com/apikey.aspx

5. Run the Application

python app.py

Visit:

(https://recommendation-system-1-gjc3.onrender.com)

๐Ÿš€ Deployment

The application is deployed on Render using:

  • Flask
  • Gunicorn
  • GitHub Integration

Start Command:

gunicorn app:app

๐Ÿ”ฎ Future Enhancements

  • Hybrid Recommendation System
  • Collaborative Filtering Integration
  • User Authentication
  • Personalized Recommendations
  • Watchlist Functionality
  • Movie Trailer Integration
  • Sentiment Analysis of Reviews
  • Genre-Based Filtering
  • Recommendation Explanation Engine

๐Ÿ‘ฉโ€๐Ÿ’ป Author

Shrisha

Computer Science Engineering Student Ajay Kumar Garg Engineering College (AKGEC)

Connect With Me


๐Ÿ“„ License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages