Project Thumbnail


Predicting customer purchase behaviour based on their purchase history


Machine Learning


June - July 2018

Tools & Stack


Keras, Tensorflow

Angular 6


In the summer of 2018, I worked with Mastercard Advisors as a summer intern where I was a part of the analytics team. I was given a solo project of using Mastercard's transaction level data of 9 million customers to predict the category of a customer's next purchase. The inspiration behind this problem was to draw insights about a cardholder's motivation, learn about high-spend merchant categories that the customer frequents while giving weight to customers' priorities.

This was an intriguing and challenging problem because of various hidden constraints like model complexity, computation time, and the random purchase behaviour of customers. I can't share the exact details about the model and its results. However, below I summarise my experience working on this problem.

Project: Machine Learning

Purchase Prediction

To predict customer behaviour, I chose to use deep learning to mimic human behaviour training on thousands of data samples of previous transactions. I used a RNN model (using Gated Recurrent Unit cells) to make sequential predictions. This model was evaluated by considering three categories of customers.

  • Biased customers: Frequenting purchases in mostly one industry
  • Patterned customers: Frequenting purchases in 3-10 industries
  • Random customers: Frequenting purchases in multiple industries ( > 10 )

The prediction results in the three cases were overlapped with untrained real data points and this evaluation helped improve the model to produce better results for the individual cases.

Reading Screen

Comparing Predictions

Taking the predictions a step further, after predicting the category of purchase with an appreciable accuracy, I was given the task to predict a time estimate for the next purchase. This was done by translating dates to a time sequence and training it over a standard neural network model.

Reading Screen

Model comparison for time predictions

The tasks were challenging due to the complete randomness of human behaviour, however that's what ML techniques are for — to find patterns that aren't obvious or easily discernable by standard algorithms. Despite the randomness, the models performed better than expected and the margin of error was within range to still have some relevance.

Project: UX Design & Frontend Development

Bulletin Operations Platform

I also contributed to the UX design and development of an internal bulletin operations web platform being built to alleviate various pain points for the bulletin's vertical and management.

We worked towards defining the use cases of this platform for different stakeholders using user personnas, created user journey maps to make the features easily accessible for each personna, proposed wireframes, and developed and deployed the entire platform within the span of the internship.

Extra Credits

Merchant Solutions AI Platform

Apart from my work, I took part in various global competitions and challenges organised for the employees. One of them led me to develop a merchant solutions platform to run AI powered campaigns. I built the platform using Angular 6.

Reading Screen
Reading Screen
Reading Screen

I was also lucky enough to file and receive two patents through Mastercard during this internship.