Skip to content

Ahmad-IKR/TheeMovieRecommender-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

TheeMovieRecommender

A highly customisable movie recommender that will give you movies based on your favourite genre/taste This project builds a movie recommendation system using the MovieLens dataset. It leverages matrix factorization with PyTorch to learn latent embeddings for users and movies, and then applies KMeans clustering on the learned movie embeddings to group similar movies. Finally, user preferences are mapped to clusters, and the system suggests movies that are popular within those clusters.

📂 Project Structure

File 1: movie_recommender_training.py

This script handles the training stage:

  • Loads the MovieLens dataset.
  • Implements a Matrix Factorization model in PyTorch (user embeddings × movie embeddings).
  • Trains the model with Mean Squared Error loss and Adam optimizer.
  • Extracts movie embeddings after training.
  • Runs KMeans clustering on embeddings to group similar movies.
  • Shows top-rated movies in each cluster (helps interpret clusters).
  • Saves the cluster labels to movie_clusters.npy for later use.

File 2: recommend_movies.py

This script is responsible for the recommendation (inference) stage:

  • Loads the MovieLens dataset.
  • Loads pre-trained cluster labels from movie_clusters.npy.
  • Maps user-selected movies to their cluster(s).
  • Identifies clusters of interest and prints recommendations from them.

🚀 Future Plans

Improve recommendation logic:

Include user-specific ratings instead of just clustering. Try more advanced models (Neural Collaborative Filtering, Autoencoders).

Hybrid recommendations:

Combine content-based filtering (genres, tags) with collaborative filtering.

Web interface:

Build a simple Flask/React app to let users input their favorite movies and get recommendations.

Larger datasets:

Scale to the MovieLens 1M / 20M datasets for richer embeddings.

Evaluation:

Add standard metrics (RMSE, precision@k, recall@k) to measure recommendation quality.

▶️ Usage

1. Train the model & clusters

python movie_recommender_training.py

This will:

  • Train the matrix factorization model
  • Cluster movies into groups
  • Save cluster labels as movie_clusters.npy

2. Get recommendations

python recommend_movies.py

This will:

  • Load saved clusters
  • Ask for favorite movies (hardcoded or user-provided)
  • Suggest other movies from the same clusters

About

A highly customisable movie recommender that will give you movies based on your favourite genre/taste

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages