I have a problem I need to solve and am looking for assistance in what algorithm to use. I have a online store that I have say 10 products and I have all the order history for every order. What I am trying to find is if a customer orders product A what is the probability that they will order product A, Product B, Etc. for their second, third, etc. order. What algorithm would work best to find the probability of what product will be purchased in repeat orders? I would like to either use R or python but if it can be done with simple math and if statements that would be even better.
1 Answer
One way is to approach as a traditional probability problem: probability of simultaneous events.
https://math.stackexchange.com/questions/375771/how-do-you-calculate-the-probability-of-simultaneous-events
This may not apply because this is more focused on probabilities of events occurring simultaneously and it sounds like you want the probability of an event occurring (purchase of a product) given another event occurring (not independent events).
A method of handling this could therefore be categorical clustering. This post has some very good explanations of k-modes clustering: K-Means clustering for mixed numeric and categorical data MATLAB also has an implementation of this: https://www.mathworks.com/help/stats/kmedoids.html
arules
package in R. It's purpose is itemset mining and association rules $\endgroup$