Recommendation Recipes
Produce a ranked list of items per customer — next-basket predictions, product discovery, or full-price conversion.
Common use cases
- Product recommendations — next items to purchase
- Next-basket prediction — which products in the next order?
- Content suggestions — articles, videos, or courses to show
- Offer personalisation — which promotions to surface
- Product acquisition — recommend items not previously purchased
Ready-to-run solutions
| Recipe | Industry | Description |
|---|---|---|
| Next-Week Purchases | Retail | Learn all seven-day purchases, including repeats, from every historical basket |
| Next Product Basket | Retail | Predict the next set of products a customer will buy |
| Product Acquisition | Retail | Recommend products not previously purchased |
| Next Content | Media | Recommend the next article or video from dated interactions |
See also: Practical guide
For the full training script, API reference, and default metrics, see the Recommendation implementation guide.
Select simple counter-baselines on validation
For regression, compare zero, the last observed value (or last complete equivalent window), and an entity's historical mean over comparable windows. For counts, include the historical weekly mean scaled to the forecast horizon. Use only history available at each cutoff. For ranking, compare catalogue popularity and, where applicable, a last-basket/repurchase ranking with the same candidate filters and k.
Choose the baseline and any window, threshold or tie rule on validation, freeze them, and compare model and baseline on the same untouched test cohort and denominator. Never choose the baseline on test. A smoke run beating repeated history can still lose to zero or a historical mean; successful execution alone is not predictive improvement.
Recommendation SEMANTIC TSV
Set TestingParams(output_type=OutputType.SEMANTIC, top_k=10) (or the chosen cutoff). Without top_k, the engine sorts and exports the full catalogue; a hit in that full list is not HR@10. An explicit cutoff reduces sorting/output work and can reduce test runtime, but exact decoding can still score all candidates. Score only the first k items and keep metric k <= top_k for both model and baseline.
prediction and ground_truth are CSV lists inside TSV fields. Both levels use CSV quoting: an item with a comma is quoted, embedded quotes are doubled, and the outer TSV reader removes its own quoting first. Ground truth can repeat an item once per event; use a set for set-based relevance, retaining multiplicity for weighted metrics. Do not use a plain comma split. A pandas reader must preserve literal names such as NA:
import csv
import pandas as pd
rows = pd.read_csv('test_predictions.tsv', sep='\t', dtype=str, keep_default_na=False)
predicted = [next(csv.reader([value])) for value in rows['prediction']]
relevant = [set(next(csv.reader([value]))) for value in rows['ground_truth']]
Earlier engine versions could export exact duplicate recommendation rows. Since 1.16 the TSV export, and the SQL write that reads it, skips dummy (padding) rows. Still preserve the raw TSV; count raw rows, unique entities, exact full-row copies and conflicting rows. Reject conflicting rows and explicitly audit any removal of exact copies before evaluation. Use monad.ui.evaluation.evaluate_predictions() for the native report; it does not remove or reject repeated entity IDs, so pass it the audited file with one row per entity. Preserve the raw export and record the audited report input. Native metrics can have a different denominator, so report the unique cohort used for comparisons.