A good shop assistant
- Lesson 1
- 30 min
- Module 1: The recommendation problem
Where we are
In the machine learning course, a model gave one answer for each row. A shop must choose a short list of products for each person, from thousands. In this lesson, we see what a recommender decides, on which page, and for whom. First, think of two shop assistants.
Lesson 1 of 29 · Recommendation and Personalisation: Show Each Person What MattersA good shop assistant
1. The recommendation problem
2. Data, implicit feedback and an honest split
3. Measure recommendations offline
4. Neighbours and collaborative filtering
5. Matrix factorisation for implicit feedback
6. Content, hybrids and cold start
7. Two stages: candidates and ranking
8. From offline scores to the real shop
9. Run it in production
What you will be able to do
Say what a recommender must decide, on which page, and for whom, before you choose any method. A list that is right for one page and one customer can be wrong, or even harmful, for another.
Before you startWhat to know and to have ready
What you need to know
- What a model does: it learns from past examples and gives an answer for a new case. Machine Learning: From Problem to Reliable Model teaches it from the start. This lesson needs only the idea.
- How online shops work from the customer’s side: a home page, product pages, a basket and emails.
What you need on your computer
Nothing. This lesson has no code. You set up the project in Meet the shop log.
Two shop assistants
Section titled “Two shop assistants”Think of a small garden and home shop in your town. You go there once a month.
The first assistant knows you. Last month you bought a wooden garden table. Today she says: “Your table is still bare. These cushions match its colour, and they are new this week.” She does not show you garden gloves, because you bought a pair in April. She does not show you a winter coat, because it is June. And when you come in with your teenage son, she does not talk about the medical product that you ordered last time.
The second assistant does not know anybody. He holds up the same poster of last year’s bestsellers to every person who walks in. Some people find something useful on it, because bestsellers are popular for a reason. But most people see things that they already own, things that are out of season, or things that they do not want anyone to see.
Both assistants make suggestions. Only the first one makes the right suggestions, for this person, at this moment. An online shop has thousands of customers and thousands of products, so no person can be that first assistant. A program must do it.
The problem: one poster for everyone
Section titled “The problem: one poster for everyone”Larkfield is the online shop of this course. It sells home and garden products, Christmas decorations, pet products and kids’ rooms. Marketplace sellers also sell outdoor clothing, wine and spirits, and health products on Larkfield’s site. Its data is synthetic: our code made the products, the customers and everything that they did, with a model of how customers behave. There are no real people in it.
Here is Larkfield’s version of the poster. It lists the 10 products that were ordered by the most customers, from the first day of the shop log up to 22 June 2026. Suppose that, on that day, the shop shows one list to everyone. This is the list:
| Place | Product | Subcategory | Problem on 22 June |
|---|---|---|---|
| 1 | Navy Nitrile-Grip Garden Gloves | Gloves and kneelers | |
| 2 | Terracotta Linen Roman-Style Curtains | Curtains | |
| 3 | Black Rustic Wooden Planter Box | Pots and planters | |
| 4 | Green Waterproof Chair Protector | Continence care | sensitive: a health product that many people want to keep private |
| 5 | Dockside Red Striped Cushion | Cushions | |
| 6 | Copper Corduroy Duffle Coat | Winter coats | winter coat in late June |
| 7 | Terracotta Ankle Garden Clogs | Garden boots | |
| 8 | Oak Timber Swing Seat | Hammocks and swings | out of stock since 15 June |
| 9 | Bramble Terracotta Mosaic Side Table | Garden tables | |
| 10 | Dockside Red Loft Bed | Kids' beds |
Three of the ten places are wasted, or worse. The duffle coat is there because 857 customers bought it over the winters. The chair protector is there because people buy it again and again. The swing seat is there because it sold well last summer and this spring. Each reason is about the past of all customers, not about the present of one customer. The winter coat and the out-of-stock swing seat are practice problems we made on purpose. You can find them in the data.
Larkfield’s next two weeks show the result. From 22 June to 5 July 2026, 2,118 customers ordered something. For 1,783 of them, none of the products that they ordered was on the poster. The chart counts, for each place of the list, the customers who ordered that product in those two weeks:
Text description of the chart
A column chart with ten columns, one for each place of the popular list. Each column is the number of customers who ordered that product between 22 June and 5 July 2026. Place 1, the garden gloves: 59. Place 2, the curtains: 48. Place 3, the planter box: 17. Place 4, the chair protector: 34. Place 5, the cushion: 43. Place 6, the duffle coat: 0, so it has no column. Place 7, the garden clogs: 16. Place 8, the swing seat: 10. Place 9, the mosaic side table: 106, the highest column. Place 10, the loft bed: 16.
The order of the poster does not match the order of what people want now. The side table at place 9 is a summer product, and it sells best. The coat at place 6 sells nothing. The swing seat still has a few orders. The shop’s stock flag says “out of stock” from 15 June, so these orders are back-orders: the customer gets the product later. Still, the poster is not useless: it found at least one ordered product for 335 customers. That is why this course keeps it as the first score to beat.
The idea: a recommender
Section titled “The idea: a recommender”A recommender (also called a recommender system) is a program that does the first assistant’s job. For one person, at one moment, it chooses a short list of products from the whole catalogue and puts them in order. The catalogue is every product that the shop sells: 2,994 at Larkfield.
A recommender that uses what it knows about the person is personal, and this is called personalisation. The poster is a recommender too, but it is not personal: everyone gets the same list. The course calls a list like that a baseline: the simple method that every better method must beat.
Every recommender answers three questions:
- What to show: which products, and in which order.
- Where: on which page or message. The course calls each place a surface.
- For whom: a customer with a long history, a customer with one order, or a visitor whom the shop has never seen.
Three surfaces, three decisions
Section titled “Three surfaces, three decisions”Larkfield wants suggestions in three places. Each place asks a different question, so each place needs a different decision.
Text description of the diagram
The diagram has three rows, one for each surface. On the product page, a customer looks at one product, for example a sofa. The question is: what goes well with this product? The answer is a row of products under it, and it drives the next click and a bigger basket. On the home page, a customer opens the shop. The question is: what does this person want today? The answer is 10 products at the top of the page, for known and new customers. In the weekly email, each subscriber gets one email on Monday morning. The question is: what is worth an email this week? The answer is a few products, or no email at all. It must give a reason to come back without losing the subscriber.
The product page
Section titled “The product page”The customer has already shown interest in one product. So the main clue is that product, not the person. A customer who looks at a sofa may want cushions, a throw or a side table: products that go with it. Larkfield calls this row “People also bought”. It works even for a visitor whom the shop does not know.
The home page
Section titled “The home page”Here the main clue is the person: what they looked at, put in the basket and ordered before. For a new visitor, the shop has no clue about the person. It must still show something useful: perhaps what sells well this week. The home page decides where a visit starts.
The weekly email
Section titled “The weekly email”The email arrives when the customer is not shopping. So it must earn its place in the inbox. A bad email costs more than a bad home page: the customer can unsubscribe, and then the shop cannot send them anything again. Sometimes the right decision is to send no email. And some inboxes are shared by a whole family, so a private product in an email can be seen by the wrong person.
For whom: most customers are almost new
Section titled “For whom: most customers are almost new”The “for whom” question is harder than it looks. Of Larkfield’s 40,000 customers, 59.5% ordered at least once in the log, and 53.7% of those ordered only once. The course sorts customers into three segments by their orders before a period:
| Segment | Orders before the period | Customers who ordered in the test period |
|---|---|---|
| new | 0 (they may have viewed products) | 952 |
| occasional | 1 or 2 | 556 |
| loyal | 3 or more | 610 |
So 952 of the 2,118 customers who ordered between 22 June and 5 July had never ordered before. A recommender that only knows how to use order history has little to work with for them. The problem of a new customer, or a new product, with no history is called cold start. Module 6 is about it.
A tiny example: one customer, three surfaces
Section titled “A tiny example: one customer, three surfaces”Here is a constructed example. Last month, a customer ordered a wooden garden table and a pair of garden gloves. Yesterday, she looked at three outdoor cushions and left. On Monday, she gets the weekly email. Her email address is shared with her family.
| Surface | What the shop knows at that moment | A good suggestion | A bad suggestion | Why it is bad |
|---|---|---|---|---|
| Product page of the cushion she looks at | the cushion | other cushions of the same range, a parasol | a winter coat | wrong season: a wasted place |
| Home page | her table, her gloves, yesterday’s cushions | the cushions she looked at, a table cover | garden gloves | she already has them: a wasted place |
| Weekly email | the same, plus “the inbox is shared” | the new summer range, one cushion | a continence care product | her family can see it: she may unsubscribe |
Each bad suggestion is a popular product. Each one is wrong only because of who, when or where. That is the job of a recommender: not to find good products, but to find the right products for one person, on one surface, now.
From a suggestion to an order
Section titled “From a suggestion to an order”A suggestion earns money only at the end of a long path. The diagram shows the steps, and what can go wrong at each one.
Text description of the diagram
The path has seven steps. A product is shown in a list of 10. The customer sees it, clicks it, puts it in the basket, orders it, keeps it and comes back next week. Under five of the steps, a dashed box shows a loss. A product low in the list is often not seen, because most people look only at the first places. A product in the wrong season, out of stock or already bought gets no click. An order that the customer would have made anyway adds no money. A returned product costs 12 dollars to handle. An annoyed customer unsubscribes from the email.
Two of these losses are easy to miss. First, some orders would have happened anyway. If a customer came to buy compost and the home page shows compost, the order is not thanks to the suggestion. Second, a returned product costs money twice: the sale is lost, and Larkfield pays to handle the return. The course uses 12 dollars for each returned product and 18 dollars a year for each email subscriber. These are assumptions of the course, not measured costs.
The shop log shows how steep the path is, for all products and not only for suggestions:
Text description of the chart
A column chart with three columns. Views: 572,465. Basket adds: 149,577. Order lines: 83,274. An order line is one product in one order. The columns fall fast from left to right: for every 100 views, there are about 26 basket adds and about 15 order lines.
So a place in a list is valuable, and there are only a few places. Every wasted place is a product that could have been seen, clicked and ordered.
Larkfield’s team
Section titled “Larkfield’s team”These people work on Larkfield’s recommender in this course. You will hear their questions in every module.
| Person | Role | What they ask |
|---|---|---|
| Priya | Data scientist, your main guide | “How do we measure it fairly, and does it beat the simple list?” |
| Omar | Product manager | “What is one suggestion worth? Do people return what we suggest?” |
| Amira | Developer | “Can we serve it fast, and what do we show when it fails?” |
| Tomás | AI engineer | He likes new methods. His ideas are often half right, and the course tests them. |
| Hana | Merchandising lead | “Can we show the new range? Do we keep a minimum margin?” |
| Rafael | Email and customer-relationship manager | “Will this email make people unsubscribe? What about shared family inboxes?” |
At the first meeting, Tomás has an idea. “Why build anything? Show everyone the bestsellers. It is simple and it works.” Priya does not say no. “It does work, a little. It found something for 335 of 2,118 customers. So it is our first baseline. But it shows a winter coat in June, and a continence product in a family’s inbox. We will measure every new method against it.” Rafael adds: “And for my email, one of those mistakes can cost a subscriber.”
When a recommender is worth it
Section titled “When a recommender is worth it”A recommender is worth building when:
- the catalogue is too large to browse: nobody looks through 2,994 products;
- customers come back, so what they did before helps you to guess what they want next;
- the cost of a place is high: a home page or an email has room for a few products only.
It is not worth it, or not yet, when:
- the shop has 20 products: show them all, sorted by category;
- almost nobody comes back: there is no history to use, and a popular list is as good as you can do;
- rules already decide: a pharmacy may not be allowed to suggest medicines at all.
A recommender also costs something. You need clean data about what people do, a fair way to measure lists, a service that answers fast, and a plan for privacy. When a customer asks you to delete their data, it must also leave the recommender. Module 9 shows how. This course builds all of it, one module at a time.
Your turn: the decision on each surface
Section titled “Your turn: the decision on each surface”For each of Larkfield’s three surfaces, write three things: the question it answers, its main clue, and one bad suggestion with its cost. Here is the product page, as an example:
| Surface | Question | Main clue | A bad suggestion and its cost |
|---|---|---|---|
| Product page | What goes well with this product? | the product on the page | a product from an unrelated category: a wasted place, no click |
| Home page | ? | ? | ? |
| Weekly email | ? | ? | ? |
Show an answer
| Surface | Question | Main clue | A bad suggestion and its cost |
|---|---|---|---|
| Product page | What goes well with this product? | the product on the page | a product from an unrelated category: a wasted place, no click |
| Home page | What does this person want today? | the person’s history; for a new visitor, what sells now | a product that the customer just bought: a wasted place, and the customer may think that the shop does not know them |
| Weekly email | What is worth an email this week, if anything? | the person’s history and the time of year | a sensitive product sent to a shared family inbox: the customer may unsubscribe (18 dollars a year under our assumption), and they lose trust in the shop |
Other answers are right too, if the question, the clue and the cost belong to that surface.
Common mistake
The bestsellers of all time
Symptom: at the end of June, Larkfield’s home page shows a duffle coat to every customer. Nobody orders it. No error appears anywhere, and the page looks normal.
Cause: the list counts orders over the whole history of the shop. The coat sold to 857 customers over the winters, so it stays near the top in summer. The count does not know what season it is, what is in stock, or what this customer already has.
Fix: ask the three questions before you build a list: what, where, and for whom. For the season, count recent orders instead of all orders. Module 2 builds that list, called “trending”. For stock and private products, add business rules. Module 7 adds them.
Consequence in AI work: a recommender never fails with an error message. It fails quietly, by showing the wrong products in a few valuable places. Only measurement shows it, and the next two lessons start that measurement.
Knowledge check
Section titled “Knowledge check”Check your understanding
What three questions must a recommender answer? Give one Larkfield example for each.
Show the answer
What to show, and in which order: for example, cushions before a parasol. Where: the product page, the home page or the weekly email. Each surface has its own question and its own main clue. For whom: a loyal customer with a long history, an occasional customer, or a new visitor with no orders. At Larkfield, 952 of the 2,118 customers who ordered in the test period were new.
Does your answer have the main points of ours?
Sign in and enroll in the course to save your answers. Every check counts toward the certificate.
Check your understanding
Predict and explain: Tomás wants to use the same popular list on all three surfaces. On which surface is the risk highest, and why?
Show the answer
The weekly email. The customer is not shopping when the email arrives. So a useless list gives a reason to unsubscribe, and the shop loses the subscriber for good. The popular list also has a continence care product at place 4. Many email addresses are shared by a family, so a private product in the email can be seen by the wrong person. On the home page, the same mistake wastes a place. In the email, it can cost the customer’s trust and the subscriber.
Does your answer have the main points of ours?
Sign in and enroll in the course to save your answers. Every check counts toward the certificate.
Check your understanding
The popular list found at least one ordered product for 335 of 2,118 customers. Why does the course keep it, if it fails so often?
Show the answer
Because it is a baseline: the simple method that every better method must beat. It needs no knowledge of the person, and it costs almost nothing. It is also right for some customers, because popular products are popular for a reason. A personal method that does not beat it is not worth its cost. The course measures every method against it.
Does your answer have the main points of ours?
Sign in and enroll in the course to save your answers. Every check counts toward the certificate.
Recap
- A recommender chooses a short, ordered list of products for one person, at one moment, from the whole catalogue. Personalisation means that it uses what it knows about that person.
- It answers three questions: what to show, where, and for whom. The surfaces are the product page, the home page and the weekly email. The customers are new, occasional or loyal.
- The same popular list for everyone wastes places. On 22 June, it shows a winter coat, an out-of-stock swing seat and a private health product. It found something for 335 of 2,118 customers, so it is the first baseline.
- A suggestion earns money only at the end of a path: seen, clicked, ordered, kept, and not bought anyway. A bad one costs a place, a return, or a subscriber.
You can now say what Larkfield’s recommender must decide on each surface. But you cannot yet say whether one list is better than another. Next, you choose what “better” means for the shop, and why more clicks can be the wrong target.
Next: What success means