New Arrival Recommendations
Rank recently introduced products for each customer’s new arrivals shelf. The target is a product the customer may purchase in the next 30 days.
This example filters a general purchase ranking to select products introduced in the previous 14 days with at least one recorded purchase. It assumes those products were represented in the graph when the model was fitted. It does not establish recommendations for products added after fitting.
Data and relationships
For training and scoring the base purchase-ranking model, see Recommend products from synthetic purchase histories, which ranks purchases over the next 30 days using customers, products, and purchases. Apply this page’s new-arrival introduction-time filter below to select recently introduced products from the ranking.
The example assumes a prepared Kumo Engine graph, a matching snapshot, and these tables:
The items and transactions pandas DataFrames used below must come from the same extracts as the snapshot.
Interpret their times consistently as UTC timestamps without timezone offsets.
Rank purchases and select new arrivals
This Python query ranks items each user may purchase over the next 30 days.
LIST_DISTINCT treats repeat purchases of an item as one target item within a window.
The query does not constrain product introduction dates; the catalog filter does that after ranking.
Here trainer is a fitted model for this query.
Replace the example prediction time with a UTC time after the latest observed purchase.
The prediction table selects users and the time; it does not fit a model.
In ranked, ENTITY identifies a user, CLASS identifies an item, and SCORE orders that user’s returned candidates.
A score does not guarantee a purchase.
Use the catalog introduction time at the same prediction time to keep products introduced during the previous 14 days. The interval includes both the cutoff and prediction time.
Keep only products with a recorded purchase by that time. This does not require a particular customer to have purchased the product before.
Each remaining row is a returned product candidate introduced within that interval, with recorded purchase history, ordered for a customer by score. Use these rows to order a new arrivals shelf after applying your catalog’s separate saleability rules. The filter checks introduction time and purchase history only.
The top 50 general purchase candidates are chosen before the catalog filter, so some customers may have no new arrival in the result. This example does not establish scoring for an item with no purchase history or one added after fitting.