RecomNext

Worked examples

Formulas and driffle-dev calculations.

07 - Worked examples

Numbers use driffle-dev ClickHouse snapshots from 2026-07-23 unless labeled hypothetical.


A. Weighted-history score

Formula reminder

total_weight = Σ weight × multiIf(purchase→4, cart→2, rating→3, else→1)

Hypothetical user

ItemRaw events (weight=1)Computationtotal_weight
10012 views, 1 cart2×1 + 1×24
10021 purchase1×44
10035 views5×15 → #1

After scenario booster boost by 1.5 where 'featured' = true on 1001 only:

  • 1001 → 4 × 1.5 = 6 → becomes #1 if featured.

Live catalog popularity (30d interaction totals by item)

Top items by the same weighted formula aggregated across all users (not a single user - illustrative of weight mass):

item_idtotal_weightviewscartspurchases
99944343413341300
98791641129112900
98843921067106700

Interpretation: almost all signal is views; cart/purchase are still rare in this tenant window - collaborative strength will be view-heavy until commerce events grow.


B. Co-occurrence

Hypothetical

Seed S. In 30d:

CandidateDistinct users who also touched SScore before boosters
R12525
R21010
R3category fallback only0.5

Booster boost by 2 where 'platform' = 'Steam' on R2 → score 20 (may pass R1 if R1 doesn’t match).


C. RRF (multi-seed-hybrid)

Two ranked lists, rrfK = 60:

Co-list: [A, B, C]
Vector-list: [B, D, A]

ItemCo contribVec contribRRF sum
A1/(60+1)=0.016391/(60+3)=0.015870.03226
B1/(60+2)=0.016131/(60+1)=0.016390.03252 → #1
C1/(60+3)=0.0158700.01587
D01/(60+2)=0.016130.01613

B wins even if raw co_count and vector distances aren’t comparable - RRF only uses ranks.


D. Constraints: diversity + freshness + purchase cap

Start scored list (category, score):

  1. G1 games 10
  2. G2 games 9
  3. G3 games 8
  4. S1 software 7
  5. G4 games 6

maxPerCategory = 2 → keep G1, G2, S1, then next non-games… (G3/G4 dropped by diversity).

Freshness: if S1 is “fresh”, score 7 × 1.5 = 10.5 → may reorder above G2 after re-sort.

Purchase cap 10% on 10 results → max 1 already-purchased item in the final 10 (floor of 10×0.1, at least 1 when purchases exist).


E. Scenario CTR (live)

pdp-similar-products, ~30d:

impressions = 48,696
clicks (type=view & slug) = 114,385
CTR = round(114385 / 48696 * 10000) / 100 = 234.9%

Tenant-wide interactions same window: views 114,554 · carts 17 · purchases 13.

Reading: CTR here is not “rail click-through.” See 09.


F. End-to-end PDP similar (intended happy path)

If the host instead calls trackView(currentSku, pdp-similar-products) on every PDP, CH fills with slug-views unrelated to rail impressions → CTR explodes.