What I Built
Recommendation engines power the discovery mechanisms behind Netflix, Spotify, and Amazon. In this project, I built a content-based recommendation system that takes any movie title you input and instantly recommends the top 5 most similar titles using Natural Language Processing.
To make it interactive and user-friendly, I built a dynamic frontend using Streamlit connected to the TMDB API for fetching real-time movie posters.
How It Works Under The Hood
Content-based filtering relies on finding similarities between items based on their descriptive metadata rather than user behavior history.
- Data Ingestion: Processed the TMDB 5000 movies dataset containing metadata for over 5,000 films.
- Feature Fusion: Extracted and consolidated critical metadata fields—including genres, plot keywords, top 3 cast members, director, and storyline synopsis—into a unified textual tag string.
- Text Preprocessing: Applied PorterStemmer to normalize word variations (e.g., 'actions', 'acting' -> 'act') and stripped common English stop words.
- Vectorization: Transformed tags into a 5,000-dimensional bag-of-words matrix using
CountVectorizer. - Cosine Distance: Computed pairwise cosine similarity across all vectors to find angular proximity.
The Magic of Cosine Similarity
Why cosine similarity instead of Euclidean distance? In high-dimensional text vector spaces, document length variations can distort Euclidean distance. Cosine similarity evaluates the angle between vectors rather than their magnitudes:
$$\text{Cosine Similarity}(A, B) = \frac{A \cdot B}{\|A\| \|B\|}$$
If two movies share common themes, their vectors point in nearly the identical direction in vector space, resulting in a score close to 1.0.
What I Learned
- Feature engineering quality has an exponential impact on recommendation relevance.
- Preprocessing and stemming text significantly reduces noise in vector spaces.
- Streamlit allows rapid deployment of intuitive data science web applications without complex frontend boilerplate.
Sometimes the most elegant mathematical formulation outperforms complex black-box architectures.

Golam Monayem
Machine Learning Engineer & Visual Designer based in Dhaka, Bangladesh. Studying CSE at Presidency University, team member at Wice BD, and building production-grade AI systems.
