4
$\begingroup$

I have a market transactions dataset including time stamps and goods as follow.

John always buy milk and bread in Super Market. Besides that, he also buys some goods like the following:

  • On Monday, John bought milk, bread {beer, chocolate}.
  • On Tuesday, John bought milk, bread {potato}.
  • On Wednesday, John bought milk, bread {chocolate, avocado, peanuts}.

Can we answer the question: "What will he buy on Thursdays?".

For example: He will buy {beer, avocado} besides milk and bread on Thursdays.

Which one should I use? Supervised or unsupervised.

Which model can I use to predict a set of goods in this case?

$\endgroup$

1 Answer 1

2
$\begingroup$

Since you have a transaction data set on your hands, we are talking clear-cut supervised learning here. And while you could certainly try to use neural networks, I think you should start simpler and switch to more complex and costly algorithms once you see the simple ones failing (this is generally a good idea).

Now form what you describe, you have some sort of time-series data, with a categorical quantity that you want to predict, for which you will want some sort of modified ARMA model. You could set up a logistic regression for each good you are interested in (i.e. beer, chocolate, potato, etc.) that will predict whether or not he will buy the product. The variables you feed into the model are a set of binary observations describing if he bought the product a day ago, a week ago, four weeks ago, etc.. Play around with those lags. The nice thing about logistic regression here is that you'll see right away what is the period of the purchases. If you see a large coefficient on the one-week-ago-variable, you know that he eats avocados weekly and so forth. Note that if something is purchased weekly, it's also purchased every four weeks, so you will have some correlation issues.

If you don't get decent predictions, you could try different models, e.g. trees or ensemble methods such as random forests or boosted trees. If those don't work either, you probably have a time series without clear periodicity. In that case you could try setting up your variables differently, e.g. using the number of days since he bought the product.

One last word of advice: You might want to check correlation between purchases. Maybe he buys avocados, tomato, and onion together to make delicious guacamole. If he then has some onions leftover, he might be inclined to buy more avocado and so on.

$\endgroup$
2
  • $\begingroup$ There are many goods in dataset. How can we label every goods in dataset? $\endgroup$
    – lotusirous
    Jul 23, 2016 at 2:43
  • $\begingroup$ Well, the first approach I talk about doesn't require labeling at all. If it is practical depends on what you mean by 'many'. Many 100s, and you'll have no problem fitting a time series model to each. You might even get away with it if it's many 1000s. Much more than that, probably no... $\endgroup$
    – dirkster
    Jul 25, 2016 at 7:08

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.