A machine learning project that recommends movies using two approaches — content-based filtering and collaborative filtering — built on the MovieLens dataset.
movie-recommendation-system/
├── data/ # MovieLens dataset (not pushed to GitHub)
├── src/
│ ├── content_model.py # TF-IDF + cosine similarity
│ ├── collab_model.py # SVD collaborative filtering │ └── evaluate.py # RMSE, MAE metrics
├── notebooks/
│ └── exploration.ipynb # EDA and model exploration
├── app.py # Streamlit web app
├── requirements.txt # Dependencies
└── README.md
- Source: MovieLens Small
- 610 users · 9,724 movies · 100,836 ratings
- Rating scale: 0.5 – 5.0
- Matrix density: 1.70% (highly sparse)
- Movies with sufficient ratings (≥10): 2,269
Download MovieLens Small from https://grouplens.org/datasets/movielens/latest/
and place the CSVs in data/ml-latest-small/
git clone https://github.com/dearnitya/Movie-recommendation-System
cd Movie-recommendation-System
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
streamlit run app.py- TF-IDF vectorisation on genres + user tags
- Cosine similarity matrix across 9,724 movies
- Example: "Toy Story" → A Bug's Life (0.86), Toy Story 2 (0.64), Monsters Inc (0.36)
- User-item matrix: 610 users × 2,269 movies
- SVD matrix factorisation (k=50 latent factors)
- Predicts ratings for unseen movies per user
- Example: User 1 → Stand by Me (3.22), Die Hard (3.18), Shawshank Redemption (2.94)
| Metric | Score | Notes |
|---|---|---|
| RMSE | 2.9045 | On 20% held-out test set (16,224 ratings) |
| MAE | 2.7054 | On 20% held-out test set |
High RMSE is expected with basic SVD on a sparse matrix (1.7% density). Production systems improve this with hyperparameter tuning, implicit feedback, and hybrid approaches. This project demonstrates the full pipeline rather than optimising a single metric.
Key findings:
- Ratings skew positive (avg 3.50) due to selection bias
- Most users rate fewer than 100 movies (power user effect)
- Most movies have very few ratings — filtered to 2,269 with ≥10
- Drama and Comedy are the dominant genres
Python · pandas · NumPy · scikit-learn · SciPy · matplotlib · Streamlit
Nityasree Iyer · B.Tech CSE (Data Science) · JAIN University
