I have an e-commerce website where customers can purchase items directly from the site. I have training data which includes order id, user id, order number, days since prior order, product id, add to cart order, reordered...

I am trying to predict, for each user, what items he will purchase on his next order. I tried to use Naive Bayes, average purchase items per user and the following equation: posterior ~ Bayes Factor x prior but the prediction outcome is not good and has many false positives and/or negatives.

Maybe I can try to first train on the number of items a user will purchase then train on the specific items he will get but not sure will it get better results. I think this can go in the multi label classification but has not used multi labels in classification before.

I am using python with sklearn, pandas...

Any better models I can use and how to train and predict variable multi labels and whether I can do it in sklearn? Keep in mind that the data is large and predicting using some of the classification algorithms in sklearn unfortunately takes huge amounts of memory so, any ideas on how to reduce memory consumption would also be useful.


1 Answer 1


First of all you have to realize these kind of problems have large amounts of noise compared to signal, because predicting what someone will buy based on a very small window of information is difficult. That said, you are throwing away a lot of information with your current approach. Temporal aspects include a ton of information, for example the sequence in which items were bought etcetera. While this is a lot more complicated than what you are describing now, you could look into recurrent neural networks where you feed history up to the point of prediction as a sequence and predict the item they will buy next as softmax classification. This will depend on the amount of products that you offer whether this is feasible or not. Another advantage is that so-called 'out-of-core' training is relatively easy with neural networks due to the iterative training of batches. Multi-label is also clean, you can just add a number of labels at the end of your graph if necessary.


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.