Skip to content

Youssef3082004/Movies_Recommendation_Systems

Repository files navigation

🎬 Movie Recommendation Systems

Python Pandas NumPy scikit-learn Matplotlib Seaborn

📑 Description

A comprehensive collection of movie recommendation engines designed to provide personalized suggestions and identify trending content based on historical movie data.

📂 Dataset

The project uses a subset of the MovieLens dataset, consisting of two primary CSV files :

1. movies.csv

Contains metadata for movies.

  • movieId: Unique identifier for each movie.
  • title: Title of the movie (includes the release year in parentheses, e.g., "Toy Story (1995)").
  • genres: Pipe-separated list of genres associated with the movie (e.g., "Adventure|Animation|Children").

2. ratings.csv

Contains user ratings for movies.

  • userId: Unique identifier for each user.
  • movieId: Reference to the movie being rated.
  • rating: User rating on a scale (e.g., 0.5 to 5.0).
  • timestamp: Time when the rating was recorded.

👉 Press here to download Dataset from Kaggle

🚀 Overview

The project is divided into two main recommendation methodologies:

1. Popularity-Based Recommender

This system recommends movies based on their overall popularity across the entire user base. It uses a Weighted Rating formula (similar to the one used by IMDb) to ensure that movies with a high average rating but very few votes don't unfairly dominate the top charts.

Key Features:

  • Feature Engineering: Extracts production years from movie titles and cleans the data.
  • Weighted Scoring: Implements a mathematical formula considering vote counts (), average ratings (), minimum vote thresholds (), and global average ratings ().
  • Global Trends: Perfect for new users where specific preference data isn't available yet ("Cold Start" problem).

2. Content-Based Recommender

This system provides personalized recommendations based on the genres of movies a specific user has already liked. It analyzes the "content" of the items to find similarities.

Key Features:

  • TF-IDF Vectorization: Converts movie genres into a mathematical matrix to understand the weight of each category.
  • Cosine Similarity: Calculates the distance between movie vectors to find the most "similar" films.
  • User Profiling: Recommends the top 10 movies most relevant to a specific user's high-rated history.
  • Data Visualization: Includes visual insights into a user's most-watched categories using seaborn and matplotlib.

3. Collaborative-Based Recommender

This system leverages the wisdom of the crowd. It recommends movies by analyzing patterns in user ratings to find similarities between users or items. If User A and User B liked similar movies in the past, the system assumes they will like similar movies in the future.

Key Features:

  • User-Item Matrix: Constructs a Pivot Table transforming the dataset into a matrix where rows represent users and columns represent movies.
  • Memory Management: Implements data sampling strategies to handle large sparse matrices efficiently on standard hardware.
  • Cosine Similarity: Calculates similarity scores between rating vectors to identify correlated movie preferences.

4. KNN Based Collaborative Filtering

This model provides recommendations by identifying users with similar taste profiles rather than finding similarities between items.

Key Features:

  • Pivot Table Structure: Unlike the item-based model, the data is pivoted with User IDs as rows and Movie Titles as columns.
  • Neighbor Identification: The model calculates the Cosine Similarity between the target user's rating vector and all other users in the system.

📁 Repository Structure

├── Datasets/
│   ├── movies.csv            # Movie IDs, titles, and genres
│   ├── CleanedMovies.csv     # Movies Dataset after splitting Year from title
│   └── ratings.csv           # User IDs, movie IDs, and ratings
├── Content_based.ipynb       # Content-based filtering implementation
├── Collabritive_based.ipynb  # Collaborative filtering implementation (User-Item Matrix)
├── KNN_Collabritive.ipynb    # Collaborative filtering implementation using KNN Algorithm
└── Popularity_based.ipynb    # Weighted popularity scoring implementation

⚙️ How it Works

  1. Preprocessing: The notebooks clean movie titles and extract the release year as a separate numerical feature.
  2. Vectorization: In the content-based approach, genres are tokenized and weighted using TF-IDF.
  3. Scoring: * Popularity: Uses the formula to calculate a robust popularity score.
  • Similarity: Uses Cosine Similarity to find movies with overlapping genre profiles.
  1. Inference: Call the Recommend_Movie(user_id, ...) function to get a list of the top 10 recommendations for any specific user.

📊 Sample Visualizations

The system provides graphical representations of a user's favorite genres, helping to visualize the underlying logic of the content-based recommendations.


Developed as part of a movie analytics and recommendation study.

About

A comprehensive collection of movie recommendation engines designed to provide personalized suggestions and identify trending content based on historical movie data.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages