Projects › Intermediate
Movie Recommendation System
Recommend movies similar to one you like using content-based filtering, served in a Streamlit web app.
Level: Intermediate · Time: 1 week · Tech stack: Python, pandas, scikit-learn, Streamlit
Features to build
- Search a movie and get 10 similar ones
- Posters from the TMDB API
- Content-based (genres, cast, overview) similarity
- Optional collaborative filtering from ratings
- Deployed web app
What you will learn
- Data cleaning with pandas
- Text vectorisation (TF-IDF)
- Cosine similarity
- Building and deploying an ML app
Step-by-step guide
1. Data
Use the TMDB 5000 or MovieLens dataset from Kaggle. Load with pandas, drop rows without overviews, merge credits.
2. Build a "tags" column
Combine overview + genres + top 3 cast + director into one lowercase string per movie. Remove spaces inside names ("Tom Hanks" → "tomhanks") so they stay one token.
3. Vectorise and compare
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
vec = TfidfVectorizer(max_features=5000, stop_words='english')
X = vec.fit_transform(movies['tags'])
sim = cosine_similarity(X)
def recommend(title, k=10):
i = movies.index[movies.title == title][0]
best = sim[i].argsort()[::-1][1:k + 1]
return movies.title.iloc[best].tolist()
4. Check quality
Try 10 movies you know. Do the results make sense? Tune which features you include.
5. App
Streamlit: a selectbox with titles, a button, and posters in st.columns(5). Save sim with pickle so the app loads instantly.
6. Deploy
Streamlit Community Cloud or Hugging Face Spaces (free). Keep the TMDB key in secrets.
Level it up
- Hybrid: mix content similarity with ratings (collaborative filtering)
- Sentence embeddings instead of TF-IDF
- User accounts with "liked" lists
On your resume
- Built a content-based movie recommender (TF-IDF + cosine similarity) over 5,000 movies with a Streamlit UI and TMDB posters.