This repository contains a complete implementation of a movie recommendation system built on the MovieLens dataset. It features matrix factorization with biases and latent factors, evaluated using RMSE, and deployed as a Django-based web application. The project also includes scripts and notebooks for individual use and Docker integration for easy setup.
This project demonstrates how advanced collaborative filtering techniques can be applied to large datasets to provide accurate and scalable recommendations. Key components include:
- Bias-only and latent factor-enhanced matrix factorization using ALS.
- A Django-based web app for users to interact with the recommendation system.
- A Python notebook for exploring results interactively.
- A Dockerized setup for hassle-free deployment.
- Recommendation Models: ALS-based models with biases, latent factors, and features.
- Django Web App: Register, login, rate movies, view recommendations, and explore datasets.
- Docker Support: Easily deploy the application using Docker.
- Interactive Notebook: Analyze models and evaluate recommendations step-by-step.
- Dataset Integration: Preprocessed MovieLens dataset included.
- Ensure Docker is installed on your system.
- Clone this repository:
git clone https://github.com/AhMedDa1/Movie-Recommender.git cd Movie-Recommender
- Build the Docker image:
docker build -t movie-recommender .
- Run the Docker container:
docker run -p 8000:8000 movie-recommender
- Open your browser and navigate to
http://localhost:8000
.
- Clone the repository and navigate to the directory:
git clone https://github.com/AhMedDa1/Movie-Recommender.git cd Movie-Recommender
- Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install dependencies:
pip install -r requirements.txt
- Apply migrations and run the Django development server:
python manage.py migrate python manage.py runserver
- Open your browser and navigate to
http://127.0.0.1:8000
.
Once the server is running (via Docker or manual setup):
- Register a new account or log in as an existing user.
- Explore movie data, rate movies, and receive personalized recommendations.
- Use visualization tools to analyze datasets and recommendations.
To run specific Python scripts without using the web interface:
- Ensure the virtual environment is activated.
- Example commands:
- Train a recommendation model:
python movies/recommendation/model.py
- Test user recommendations:
python movies/recommendation/dummy_user.py
- Train a recommendation model:
The Jupyter notebook for this project is located at:
movies/recommendation/ahmeda_recommender_systemLastupdate.ipynb
- Activate the virtual environment.
- Install Jupyter if not already installed:
pip install jupyter
- Launch the notebook:
jupyter notebook
- Open the file and explore the recommendation pipeline.
Movie-Recommender/
├── Data/
│ ├── links.csv
│ ├── movies.csv
│ └── ratings.csv
├── db.sqlite3
├── Dockerfile
├── LICENSE
├── manage.py
├── movies/
│ ├── recommendation/ # Recommendation logic and data
│ │ ├── ahmeda_recommender_systemLastupdate.ipynb
│ │ ├── dataset.py
│ │ ├── model.py
│ │ └── dummy_user.py
│ ├── templates/ # HTML templates for the web app
│ └── views.py
├── requirements.txt
└── staticfiles/
The project uses the MovieLens 25M dataset, preprocessed for analysis. Key files include:
ratings.csv
: User-movie ratings.movies.csv
: Movie metadata.links.csv
: External links to movie pages.
- Evaluation Metrics: RMSE for both training and test datasets.
- Model Performance: Bias-only and latent factor models compared.
- Visualizations:
- Distribution of ratings, genres, and user preferences.
- Embedding spaces for items and genres using PCA.
This project is licensed under the MIT License. See the LICENSE
file for details.