Suppose I'm running an online store that sells many products, but from only a couple of categories, say: $A$, $B$, or $C$.

Let's say a user has bought a product in the A category, and there's no sense of recommending to him products from that category, at least for some time. This might be in a form of a "you might also like" panel, or indeed a modification to the recommendation engine itself.

Even better: let's suppose that I know the probability density $P(\Delta t | A)$ of a product being re-bought after time $\Delta t$ from within the $A$ category (same for other categories).

My question is: how to choose the time threshold $\tau_X$ for each category $X\in \{A, B, C\}$ such that once a product in category $X$ was bought by a given user, other products from that category are not going to be recommended to that user for time $ \tau_X$?

The main "gain" from not showing a user products from that category is that we can use the recommendation slots for other categories, thus increasing the chance of the user buying new products (from other categories).

Does this set up resemble any well-known problem? What keywords should I google to find a more formal problem statement and/or possible solutions?


1 Answer 1


Interesting, so yeah I assume you can find out the time between purchases within category from your data. Some random ideas:

The simplest answer I can think of is to find the mean time per category and use that as the threshold. Empirically, it's the point at which customers are more likely than not to have bought again.

That's fairly binary, just removing all recommendations from a category. You could imagine, say, keeping 20% of the top recommendations in category A when the cumulative probability of enough time having elapsed is 20%. Or factoring it into a scoring function, and multiply by this probability and then rerank. (That is, there's an 80% chance not interested at all, and a 20% chance interested as usual.)

To do that you'll probably need to fit a distribution, and Weibull seems attractive. As a generalization of exponential, which can be thought of time between events like purchases where the rate is constant, it can accommodate a rate that increases over time. That is, the rate of repurchase starts off low and increases.

Both of those are too pessimistic as you more want to assess when they're as willing as ever to buy again, not so much buy again, which may be pretty infrequent in your data. Perhaps you model the rate of purchase per category among those who have and have not purchased in the category and empirically figure out when the rate goes back to similar.

  • 2
    $\begingroup$ To this answer I would only add one interesting reference I came across why looking for session-based RS, thesis of J. Wang 2013: "Session Aware Recommender System in E-Commerce". In this work two cross-session methods are introduces that are related to this question: (1) using marginal net utility of product - interesting idea especially for re-purchase, (2) opportunity model to recommend right product at right time - learning to predict a time for follow-up product inspired by the hazards model in survival analysis. Work contains lots of useful refs for this topic. Hope it will help. $\endgroup$ Feb 24, 2020 at 20:29
  • $\begingroup$ @BartłomiejTwardowski that's a very good reference, thanks! $\endgroup$
    – ponadto
    Feb 25, 2020 at 20:20
  • $\begingroup$ @Sean Owen I was thinking about something along those lines (more simplistic for the first go, TBH), but it got me thinking: the initial distribution $P(\Delta t | X)$ will change as a consequence of the model's decisions. So there's an "explore / exploit" dilemma that I'll need to address. I was wondering if you have an idea how to approach that? I was thinking of sampling the $\tau_X$ from a posterior distribution that is iteratively computed (not sure how yet, just an outline). $\endgroup$
    – ponadto
    Feb 25, 2020 at 20:23
  • $\begingroup$ There is no right answer as it depends on how valuable exploration vs exploitation is. The posterior only tells you how much to discount the normal value of 'exploitation'. You have to figure out the value of exploitation (how much $ does recommending the best items you can think of generate) vs exploitation (much harder to quantify; how much do you value uplift on the increased value of future exploitation). Exploration % is probably ~10%? For a start on more principled treatment, bayesian bandits? towardsdatascience.com/… $\endgroup$
    – Sean Owen
    Mar 1, 2020 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.