Skip to content

Use RFM and aggregation features to predict whether a customer will purchase within the next month

License

Notifications You must be signed in to change notification settings

W-Tran/predicting-next-purchase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Predicting next purchase month

Using the same dataset and daily aggregation statistics as in the Customer Segmentation project, build a ML classifier to predict whether a customer will purchase within the next month. The data was split into holdout and calibration sets, akin to time series cross validation, to avoid data leakage.

Specifically, cut-off points were selected at the beginning of each month called "observation end dates". All transactions before the observation end date were used to train the model and build the test features, whilst transactions after the observation end date were used as the test labels, 1 if the customer purchased within the next month, 0 otherwise.

The model was compared to a naive baseline which predicted that all customers with a purchase frequency less than a month will purchase again within the next month. A small lift in accuracy over the naive model is observed throughout the first and second year, however there is considerable lift over the naive model in precision after training the model on 1 year of data.

The rationale behind evaluating using precision is that we care most about True Positives, a customer purchasing when we think they will, as it represents anticipation of voluntary customer engagement. We could for example use this information to act to prevent high risk customers who are still "alive" from churning.

Notes/Future work

  • Probabilistic BTYD models were explored for use in this project. However most available packages were not able to deal with the heavy seasonality in the purchase behaviour for this particular online retail (a gift shop which sees a huge surge in sales leading up to Christmas).
  • Discrete Survival models were also explored for use in this project (inspired by this talk) but also failed to perform well in predicting purchase behaviour. Study survival models a bit more in the future to explore ways in which they can be used for online retail settings.

Installation

Simply clone the repo and install all dependencies listed in the requirements.txt file to an environment of your choice.

Usage

All results and plots can be reproduced using the predicting_purchases_in_next_month.ipynb notebook.

About

Use RFM and aggregation features to predict whether a customer will purchase within the next month

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published