Skip to content

Predicting Customer Behavior with AI: A Starter Guide

March 30, 2019

New machine learning capabilities have unleashed potential for even smaller businesses. How we leveraged AI to turn data into fortune telling - and how you can too.

By Matthew Moxam, Senior Consultant and Pratik Panchal, Technical Consultant

With the advent of the Cloud and increased computing power, AI and machine learning have given rise to the ability to process massive amounts of data at scale. On the surface, this may seem like it has little relevance to the practice of business, and really applies to cutting-edge research or informatics.

The eCommerce industry has been harnessing the power of data for decades, using it to predict customer behavior. Even the least digitally conscious of today’s consumers have recognized that Amazon knows their favorite brand of toothpaste.

What this means is that our ability to predict customer behavior has also massively improved.

Few companies, however, have the horsepower behind Amazon’s data tracking and processing. So how can the average business utilize these tools to drive value?

The answer varies depending on what your needs as an organization are, but a typical starting point is to first identify something you would like to know about your customers.

Customer Behavior Questionnaire

Simple standard questions to ask yourself about your customers are:

  • What is X customer most likely to buy next?
  • How many of Y items will X customer purchase next?
  • When is X customer most likely to next make a purchase?

This list can quickly grow long and complex.

For this article, we’ll focus on how we can drive value by answering even one of these questions, and more importantly, we’ll explore how to answer them.

The value of knowing what your customer will buy next seems self-evident. On the business end, it ensures you have adequate amounts in stock and helps suggest other products relevant to their needs, personalizing their experience.

Accordingly, if you know what people are going to buy, and how much of it, you can ensure that everything is in place to make that customer’s experience smooth and painless. It allows you to stock adequate amounts, prepare for spikes in traffic, and set systems in place to collect solid data and better analyze purchasing patterns.

Thus, the value of answering one question can impact business processes, minimize disruption, improve customer satisfaction…and lead to even more questions.

For example, you now know what and how much – but when are these purchases going to happen?

Knowing when a customer will make a purchase seems an ambitious question.

Nonetheless, it’s one we tackled for a large ecommerce B2B retailer.

We approached it using the standard Machine Learning tools Keras and TensorFlow and utilized Regression and LSTM models for make predictions.

These are common machine learning tools and algorithms that allow us to train and make predictions based on our data. We also employed Elastic Search to store and visualize our data and prediction results.

Of course, even the best tools are obsolete without solid data on which to pull and train prediction models. We used data on users’ search history, clicks, filters, purchase histories, and any other useful site activity metrics in the customer journey, even if it was just while browsing.

How accurate is customer prediction?

Standard machine learning works like this:

  • Create your training data
  • Create a model
  • Train the model
  • Make predictions against the model

None of this is magic or rocket science: ultimately, we are simply drawing a curve across similar outcomes, and predictions are pulled from the points closest to the curve. The complexity of this can grow, of course, and different algorithms are used depending on the type of problem to be solved.

We created a model based on 2 years’ worth of data and then made predictions against data that was collected several months after.

The results are summarized below:

 

PredictingCustomerBehaviorChart1

 

The above shows the results of predicting when a customer will next make a purchase from the site using a regression model. Each slice is numbered 0 to 9, representing the exact number of days the prediction was off by. The percentage figure is the number of predicted dates that fall in that group.

The results show that 18.9% of the time, we can accurately predict the exact date that a customer will make a purchase on the platform. 32.8% of the time, we can accurately predict the next date that a customer will make a purchase within 24 hours.

 

PredictingCustomerBehaviorChart2

 

The above shows the results of predicting when a customer will next make a purchase from the site using a LSTM model. The results show that 21.41% of the time, we can accurately predict the exact date that a customer will make a purchase on the platform. 36.92% of the time, we can accurately predict the next date that a customer will make a purchase within 24 hours.

These results show that we can accurately predict the exact week that a customer will return to make a purchase. An astonishing half the time, we can predict the customer’s return date within a day.

This is amazing data for a business to have, and just scratches the surface of the types of questions that we can answer and the predictions that we can accurately make.

How to train your machine

Here is a quick breakdown to summarize how we used machine learning and AI to predict when next a customer will make a purchase:

  • We used 2 different types of AI Models to make predictions
  • Predictions were done against customers after the training period
  • 21% of the time we predicted the exact day
  • 55% of the time we predicted at least 1 day off
  • 85% of the time we predicted 2 to 3 days off
  • 92% of the time we predicted the exact week the customer ordered
  • No optimizations were done
  • Customers with more activity and data are expected to provide more accurate estimates

Implications

The biggest businesses have used predictive analytics in myriad ways to boost businesses and get the most bang for their buck, at all stages of the sales cycle. Starbucks used it to find best place to open locations. Netflix’s mammoth success has stemmed partially from its ability to predict its consumers’ viewing activity – what they’ll choose, what they’ll skip, how much they’ll binge (a lot).

However, you don’t need to be building stores or constructing thousands of personal cinemas to use AI. The use cases for your business are endless.

Make your social media channels responsive and personal by predicting what questions consumers will ask a chatbot and prepare answers for them.

Change your product offerings based on changes in weather or season.

Know what site activity means a customer has switched from idly browsing to actively searching for something and are more likely to complete a purchase.

The value of answering these types of predictive questions is huge, and its potential is limited only to a business’ imagination.

Related Articles

Making Customer Discovery Work

April 17, 2014

Learn how to drive more conversions and improve CX with a new solution that empowers users to extract customer insights from big data.

Read More

Do you have the insight to truly engage your customers?

April 2, 2017

Unlock your big data to discover what will drive more sales

Read More
site search showdown

Who comes out on top in the search platform showdown?

November 11, 2014

Which e-commerce search platform makes the most sense for your retail business? Read this “Magic Quadrant” style analysis to find out!

Read More