created by Jason Tsai from National Yang Ming Chiao Tung University, Taiwan.
We construct the model through methods like RFM analysis and Apriori to deal with real-world data provided by a well-known retailer. The basic concept of our model is that customers tend to place an order through their "Shopping Experience." On the other hand, if a product is frequently bought by other customers(i.e., a popular product), it is likely to generate a favorable result to improve the performance of our model if we add them into the final basket. Based on the knowledge above, we predict customers' next basket through their order history and popular products during each period by segment after a simple RFM analysis. Furthermore, we introduced the Apriori algorithm to the model at the end of the prediction.
- Prepare the data for Apriori
- Prepare the data for RFM analysis
- Generate the list of customers' next basket
- Generate the F1 scores of prediction by segments
- Run Apriori
Python 3.9.12
os
time
tqdm
pandas
apyori
pymysql