π¬ Moodvie
Mood-Based Movie Recommendation System
A machine learning application that recommends movies based on your current mood and preferred music genre. Built as my master's capstone project.
Project Overview
Moodvie is a supervised learning recommendation system that combines movie metadata, mood-based features, and music genre preferences to deliver personalized movie suggestions. The system was built from the ground up: data collection, feature engineering, model training, evaluation, and deployment on Streamlit Cloud.
The Problem
Why Movie Recommendations Matter
Netflix, Hulu, and other streaming platforms use recommendation algorithms to keep users engaged. However, these systems often fall short in one key way: they don't account for the user's current mood.
Sometimes you want an uplifting comedy. Other times, you need a gripping drama or a mind-bending thriller. Traditional recommendations are based on viewing history aloneβnot on how you're feeling right now.
Moodvie's Challenge: Can we build a system that predicts which movies will resonate with a user's mood and musical taste preferences?
The Approach
1. Data Collection & Preparation
I merged two movie databases (Cinatomy and TMDB) to create a rich feature set of ~1,000 movies. Features included:
- Cinatomy ratings: 17 numeric features capturing emotional and structural aspects of films
- IMDb & Metacritic scores: Global audience sentiment metrics
- Box office gross: Commercial success indicator
- AI-generated mood labels & musical genres: Created using Claude API with few-shot prompting
2. Feature Engineering
To frame the problem as a regression task, I generated movie pairs and calculated their similarity as regression targets. This "pairwise regression" approach allows the model to learn nuanced relationships between movies based on their mood and feature profiles.
- Created ~498,500 movie pairs from the cleaned dataset
- Computed cosine similarity between paired movies as the regression target
- Used 17 Cinatomy features Γ 2 (for pairs) + metadata = 34 input features
3. Model Selection & Training
I compared two tree-based models known for their robustness:
- XGBoost: Gradient boosting with regularization
- Random Forest: Ensemble of decision trees
The final model uses XGBoost with tuned hyperparameters, evaluated on test metrics (MAE, RMSE, Accuracy, F1 Score). Model and preprocessing pipeline saved as pickled artifacts for deployment.
4. Deployment
The trained model is deployed as an interactive web application built with Streamlit. Users select a reference movie and musical genre, and the system recommends the most similar movie based on the trained model's predictions.
Results & Impact
Model Performance
The XGBoost model achieved strong performance on held-out test data:
- Mean Absolute Error (MAE): ~0.033 (on 0-1 similarity scale)
- Root Mean Squared Error (RMSE): ~0.037
- Accuracy & F1 Score: Calculated on similarity-based classification thresholds
Note: The model was trained on derived labels (cosine similarity) from the same feature set used as input. This architectural decision is documented in the methodology and represents an intentional design constraint given the absence of user behavior data.
Key Insights
- Cinatomy emotional and structural ratings are strong predictors of movie similarity
- Combining multiple feature sources (IMDb, Metacritic, box office) improves generalization
- AI-generated mood labels and musical genres enhance personalization capabilities
Try Moodvie
Ready to get a recommendation?
Click below to launch the live Moodvie app and try it yourself. Pick a movie you love and a music genre that matches your moodβlet the model recommend what to watch next.
Technical Stack
Programming
- β Python 3.x
- β Jupyter Notebooks (development)
- β Streamlit (web deployment)
Data Science
- β XGBoost & Random Forest
- β Scikit-learn (Pipeline, ColumnTransformer)
- β Pandas, NumPy, SciPy
Data Sources
- β Cinatomy (movie features)
- β TMDB (metadata)
- β Claude API (genre/mood labels)
Deployment
- β Streamlit Cloud
- β GitHub (source control)
- β Custom domain (https://moodvie-bn9vh3nf2dbhftqfhhmqim.streamlit.app)
Limitations & Future Work
Current Limitations
- No user behavior data: The model is trained on movie-to-movie similarity, not user interaction history. Real-world systems would benefit from user ratings or watch history.
- Derived labels: Regression targets (cosine similarity) are computed from the same features used as model input. This is an intentional architectural constraint, documented in the methodology.
- Genre scope: Currently limited to AI-generated musical genres. Future versions could expand to additional mood/genre combinations.
Possible Improvements
- Integrate user ratings or watch history (if data becomes available)
- Expand categorical features to include in pairwise training
- Experiment with deep learning approaches (neural networks)
- A/B test recommendation quality with real users
Reflections & Learnings
What I Learned
- Perfect metrics are a red flag. Early models with suspiciously perfect test metrics revealed data leakage. The final model with realistic error metrics (MAE ~0.033) was the correct choice.
- Feature engineering is 80% of the work. The time spent cleaning, merging, and engineering features far outweighed model tuning time.
- Deployment complexity matters. Moving from Jupyter to production revealed issues in version management and artifact serialization that were invisible in notebooks.
- Mentorship anchors architectural decisions. Regular feedback from my mentor ensured the pairwise regression approach was sound and the trade-offs were intentional.