← Back to Docs
Recipe

Personalized gift finder

Build a recommendation engine that matches recipients to products using weighted preference vectors and collaborative filtering.

Overview

This recipe walks through constructing a lightweight gift-matching pipeline. You will ingest recipient profiles, score products against preference dimensions, and surface ranked results — all without external ML services.

Ingredients

  • Recipient profile store (KV or Postgres)
  • Product catalog with tag vectors
  • Weighted cosine similarity scorer
  • Budget filter and deduplication layer
  • Result cache with TTL

Steps

  1. Normalize recipient preferences into a sparse float vector keyed by tag ID.
  2. Fetch candidate products within budget range; exclude previously purchased items.
  3. Compute cosine similarity between recipient vector and each product tag vector.
  4. Apply recency boost and popularity decay multipliers to raw scores.
  5. Sort descending, take top-N, and cache the result set keyed by recipient ID.

Cold-start fallback

When a recipient has fewer than three preference signals, fall back to a curated trending list segmented by broad demographic bucket. Log the fallback event so you can measure coverage over time.