r/webdev •

Would this be a good product recommendation system?

[deleted] — view deleted post

0 Upvotes

4 comments sorted by

1

u/acefolio_dev 1d ago

Seems like a solid simple setup, the 5 random slots are a nice touch since they stop the feed from getting stuck on one tag. Two cheap upgrades: make tag scores decay over time so old interests fade, and keep a list of what each user already bought or saw so those items don't keep coming back in the feed. A likes/buys weighting (a purchase counting more than a like) is also easy to add without making it complex.

1

u/Greedy_Ad_7658 1d ago

It's a solid simple design, and the 5 random slots are the right instinct because they stop the feed from locking into whatever the user clicked first. A few cheap changes that don't add much complexity:

Store a numeric score per tag instead of a sorted list of four. Likes and purchases add points (a purchase more than a like), "do not recommend" subtracts, and every score decays a little over time. Then the top four are just the four highest scores, and you avoid the odd cases where one click bumps a tag past another and the order flips back and forth.

Don't let a "do not recommend" fully kill a tag forever. Let it decay back toward zero so a one-off mistap doesn't hide a category permanently.

Filter out products the user already bought or recently dismissed before filling the 25 slots, otherwise the top tag will keep showing the same items.

Within a tag, sort by something simple like popularity or recency rather than random, and mix in a little variety so it isn't ten near-identical products.

For the random slots, pick from tags the user hasn't seen much instead of fully random. That finds new interests faster.

To know whether it works, log what was shown and what was clicked or bought, and compare against a plain "popular items" feed. That tells you if the extra logic is paying off before you make it more complex.

1

u/DevDanish 1d ago

It's a really clean v1, especially keeping 5 slots for discovery so the feed doesn't get trapped in a single category. A few edge cases worth handling early without adding ML: 1) Cold start & sparse tag lists: if a new user only has 0-2 tags, decide explicitly how empty slots roll over—filling them with trending/top-converting items rather than pure random prevents a weak first-session feed. 2) Seen/purchased exclusion: since each product has one main tag, the top 10 slots can serve the exact same items on every refresh. Tracking a rolling window of recently shown or purchased product IDs and excluding them in your bucketed SQL query (UNION ALL with LIMIT per tag) keeps the feed fresh without changing the scoring model. 3) Hysteresis on swaps: using a small numeric score per tag (+1 like, +3 purchase, -2 "do not recommend") with a slight weekly decay stops a single random click from oscillating tag #4 in and out.

1

u/miria01 1d ago

Are the tags roughly similar in how many products they contain? If one has a much smaller catalog, giving it fixed slots could make those items repeat quickly.