I'm fiddling around with some data that represent grocery store transactions. The data are in the following form:

Each row represents a final transaction by a customer, with a column for user ID, timestamp of purchase, and basket contents. For example:

| ID | Timestamp | Basket |

| 12 | 2016-04-02 | ['Celery', 'Beets', 'Cheese'] |

The question I'm trying to answer is "How do I suggest an ideal basket to an individual customer?"

Problems I'm dealing with:

  1. I can't seem to think past just suggesting the most frequently ordered items to a customer. Is there some technique that I'm missing here?

  2. Since we have a customer ID, we can have multiple baskets for a customer over time. Because of this, I can't use apriori or eclat as those assume each transaction is independent.

  3. How can I take into account seasonality with whatever technique I choose?

I'd really appreciate some general direction here, I'm having some serious analysis paralysis.

  • 2
    $\begingroup$ Here is a presentation on how Instacart did it recently. Welcome to the site! $\endgroup$ – Emre Nov 16 '17 at 20:43
  • $\begingroup$ And here is how they are doing it now. $\endgroup$ – Emre Nov 17 '17 at 6:25

I think that you can approach this problem in a better way. To do so you need some Customer Demographics. Even if you try doing some recommendation using customer ID it won't give you ideal Basket/Recommendation, because from Customer ID alone you can't decide anything.

Is there any possibility to get Transaction Id, so that you can unique baskets to apply Aprori Algo/ any association mining techniques by which you can give good recommendation using Lift and Support.

In the time stamp do you have time? As your sample record doesn't show time in it(just for confirmation), Let us consider a scenario you have it. Now ['Celery', 'Beets', 'Cheese'] - transform as Basket-1, ['Celery', 'Bread', 'Cheese'] as Basket-2 and so on... Now you see which Baskets are sold the most WRT timestamp. This is to see if there is any seasonality in the data and you can even find some trends, if there are any.

This is just one way of looking at the problem but this is not the concrete solution.

  • $\begingroup$ Thanks for taking the time to leave some feedback on my question. This is the most informative answer I've gotten yet, but obviously isn't an answer. Thanks so much! $\endgroup$ – Daniel Nov 20 '17 at 15:54
  • $\begingroup$ If you are stuck somewhere, do share the issue, will try to help you. $\endgroup$ – Toros91 Nov 21 '17 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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