Personas
pkg/internal/mock/persona is the four shoppers the traffic is generated for, each a taste vector over the catalog's dimensions. Here they are, as the tests see them: each one's taste, favourite in every category, and ranking of the whole catalog.
Shown by TestExhibit in pkg/internal/mock/persona: the four shoppers the traffic is generated for, each a taste vector, chosen so that each one's favourite is a different product. Each picks from the first 6 positions of a listing what scores at least 80% of its favourite there (how a persona chooses).
Tastes
Each persona's taste vector, the occasion it browses (its strongest occasion dimension), and its favourite in every category. Fashion and home share some dimensions and not others: the home-only ones (cozy, natural, industrial) come from the personas' own vectors, the shared ones carry over from what they wear.
Kate
| modern | -1.00 | |
|---|---|---|
| classic | +0.99 | |
| business | +0.90 | |
| structured | +0.80 | |
| cozy | +0.50 | |
| edgy | -0.50 | |
| retro | +0.30 |
Sofia
| festive | +0.95 | |
|---|---|---|
| romantic | +0.90 | |
| opulent | +0.85 | |
| feminine | +0.80 | |
| bold | +0.70 | |
| minimalistic | -0.70 | |
| colourful | +0.50 |
Lena
| casual | +0.90 | |
|---|---|---|
| opulent | -0.90 | |
| minimalistic | +0.80 | |
| natural | +0.80 | |
| modern | +0.60 | |
| bohemian | +0.50 | |
| edgy | +0.40 |
Mira
| modern | +0.90 | |
|---|---|---|
| industrial | +0.80 | |
| minimalistic | +0.75 | |
| business | +0.70 | |
| edgy | +0.70 | |
| classic | -0.60 | |
| structured | +0.60 |
Rankings
The whole catalog, both departments, ordered by each persona's score: its taste against each product's attractor, in the product's own category's weights. The front of each row should look like the persona, the back like its opposite.
Chosen to discriminate
persona.All() // Kate, Sofia, Lena, Mira
persona.Kate // persona.Persona{Name, Description, Affinity}Kate and Mira both dress for business but sit at opposite ends of classic and modern, so occasion alone never decides the outcome. Both fashion rails compete in one ranking, each product scored with its own category's weights, so each persona's top match is a different product, and three of them are trousers. Kate's is a pair of trousers because the trouser weights count tailoring more than the dress weights do:
| Persona | Top match | |
|---|---|---|
| Kate | conservative lawyer | Temple Pleated Trousers |
| Sofia | event host, glamour | Odette Tulle Ballgown |
| Lena | designer, dresses down | Haven Joggers |
| Mira | architect, contemporary business | Grid Cigarette Trousers |
Persona.Occasion() is the section of the shop a persona browses: its strongest occasion dimension, not a field set per persona. Persona.TopMatch(items) is its favourite among items, by catalog.Score.
How a persona chooses
A persona decides what a shopper picks, and nothing else: the shop never sees it. A shopper doesn't read a listing to the end and take the optimum. Persona.Choose scans the first ScanDepth (6) positions, considers what it likes well enough (at least GoodEnough, 80%, of its favourite's score in that listing) and picks one, the earlier positions more likely: position n weighs 1/n. If nothing near the top suits it, it scrolls on to its favourite. The pick is seeded, so the traffic stays reproducible.
So a shopper does not always open the first product, nor, from a listing not yet ranked for it, necessarily its best match. Because the shop learns from what was opened, a pick that is not the favourite feeds back into the ranking: Sofia lands on the sequin cocktail dress on her first visit and the shop shows it first for a while, until she finds her way to the tulle ballgown.
Avatars
Persona.SVG() draws an avatar (persona_kate.svg …) next to the product images. A persona's hairstyle and accessories come from its taste vector, and it wears the colour of its top-match product.
