Upload 5_netflix_genre.md with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142# Classifying Netflix Titles by Genre Using TF-IDF and Logistic Regression
When a streaming platform recommends "because you watched X," genre is a big part of the matching. In this project I built a classifier that reads a Netflix title's name and description and guesses its primary genre — automatically. No human tagging required.
## The Data
I used the Netflix Movies and TV Shows dataset (8,807 titles with 12 columns). For this task the two most important columns are:
- `title` + `description` — the input text- `listed_in` — the genre labels
I took the first genre in `listed_in` as the primary genre and kept only genres with at least 20 examples, which left **26 genre classes**. Popular ones include Dramas, Comedies, Action & Adventure, Documentaries, and International TV Shows.
## The Approach
My pipeline was deliberately simple and fast:
1. **TF-IDF vectorization** — converts the title + description text into numbers, weighing words by how informative they are (common words get downweighted).2. **Logistic Regression** — a linear classifier. Logistic regression on TF-IDF is a classic NLP baseline that is cheap to train and easy to interpret. It handles 26 classes via one-vs-rest.
## Results
- **Test accuracy: 45.9%** across 26 classes
45.9% sounds modest, but guess a random genre out of 26 and you'd hit about 3.8%. So the model is learning real patterns — it just cannot always pin down genres that blend together (is it a Drama, a Comedy, or both?).
## What Didn't Work (and What Would Help)
The accuracy ceiling here comes mostly from the labels themselves. Netflix genres overlap heavily — a "Romantic Comedies" title is both Romance and Comedy, and there's genuine ambiguity even for a human. The description text is also short, so there's limited signal.
The clear improvements are:- Use the **full genre list** instead of just the primary one (multi-label classification).- Try a transformer embedding instead of TF-IDF for richer understanding.- Feed in cast and director as extra features.
## Key Takeaways
- TF-IDF + Logistic Regression is a fast, dependable baseline that handles text classification with almost no tuning.- Multi-class accuracy should always be judged against the "random guess" baseline, not against 100%.- When the labels overlap, a multi-label formulation matches the problem better than a single-label one.
The classifier is published on Kaggle as a ready-to-load sklearn Pipeline, with a demo notebook that classifies any new title+description you paste in.5_netflix_genre.mdAdded+42