- Internship · 2021
- Recommender systems
- Collaborative + content
- Python · Flask · SQL
E-Commerce Recommendation Engine
A store with a million products, and one shopper. Which handful do you put in front of them, right now, as they browse?
- HybridCollaborative + content-based
- Real-timeSession-aware ranking
- Two-stageRetrieve → rank
Too many products, too little attention
A large e-commerce catalogue holds hundreds of thousands of items; a shopper will look at a dozen. Showing everyone the same best-sellers wastes that attention. The job of a recommender is to put the few most relevant items in front of each person, and to update that choice as they move through the site, click by click.
Who you are, and what you're doing now
Good recommendations draw on two very different signals. One is long-term history: everything you've bought and rated before, which says who you are as a shopper. The other is the live session: the items you've clicked, searched and viewed in the last few minutes, which says what you want today. This engine uses both, and weighs the fresh signal heavily.
"People like you also bought…"
Collaborative filtering never looks at what a product is. It learns from behaviour: every shopper and every item is turned into a vector (a learned embedding, from matrix factorisation over the purchase matrix), placed so that people who buy alike, and items bought together, sit close. To recommend, it simply reads off the nearest items. Click a product to see its neighbours in that learned space.
Distance = learned similarity. The clusters emerge from behaviour alone; no one labelled them.
…and "more like what you looked at"
Collaborative filtering has a blind spot: a brand-new item nobody has bought yet has no behaviour to learn from (the cold-start problem). Content-based filtering fills it. Each item carries a feature vector (category, brand, price band, specs, text and image features), and the engine recommends items whose features match what you engaged with. It needs no purchase history, so it works from a shopper's very first click.
Content-based covers new items and new shoppers; collaborative captures taste that features can't describe. Together they cover each other's gaps.
Two stages: retrieve a few hundred, then rank them
Scoring a million items for every page view is impossible in the milliseconds a page has. So production recommenders split the work. Candidate generation cheaply retrieves a few hundred plausible items from collaborative neighbours, content matches and what's trending. Then a heavier ranking model scores just those, folding in live session features, and returns the top handful. Served behind a Flask API over a SQL store.
Flask serves the request; SQL holds the catalogue, interactions and precomputed embeddings.
Pick a shopper, then browse
Choose a shopper profile to set the long-term history, then click products to "view" them and watch the recommendation rail re-rank in real time. Each pick shows why it's there: collaborative, content, your profile, or trending. This is the hybrid, two-stage idea in miniature.
Scores and the blend are illustrative: a faithful sketch of how a hybrid ranker behaves, not the production model.