Problem
Category managers at a quick-commerce retailer build a weekly assortment matrix of about 8000 items for each of about 2000 dark stores. Storage capacity is fixed: an overfilled freezer spoils goods, so every slot must hold products that sell. Managers rely on experience and assortment A/B tests and have no systematic view of which products drive each other's sales. A customer who plans a joint purchase may then go to another store.
Example from the article: in the morning sample cookies and pasteurized milk form a strong pair, but the pair disappears from the evening sample, although both products are bought more in the evening.
Solution in brief
Mine frequent itemsets from fulfilled-order receipts with FP-growth, compute association-rule metrics and rank pairs by Zhang's metric. Run it on individual products, not on the smallest categories, slice it by region, time of day and dark-store type, and review top pairs by hand. A colored network graph shows each product's neighbors.
Questions this case answers
- How to find pairs of items that drive each other's purchase from transaction logs when the catalog has thousands of items and each segment of the data behaves differently
- How to turn a table of association-rule metrics into a view a non-technical decision maker can read when the full item graph is unreadable
- How to find which products customers buy together from receipt data?
- How to choose which products to launch together in each store with limited shelf and freezer space?
Tools and methods
- FP-growth — finds frequent itemsets in receipts without generating candidates
- Association rules — support, confidence, lift, leverage, conviction and Zhang's metric for each pair
- mlxtend —
fpgrowth,association_rules,TransactionEncoder - pandas — builds the receipt table and the one-hot encoded frame
- pyvis — draws the link graph, one color per top-level category
Google or a one-time email code. No password.
