Explaining the “Why” behind consumer spending on Black Friday

uio uzxc
12 min readNov 27, 2020

Photo by Ashkan Forouzani on Unsplash

In 2020, life as we know it changed overnight, and humanity as a collective is still figuring out what our new normal will be. Due to the Pandemic, everyone in all walks of life got more familiar with the concept of data and insights. For most of the year, all of us were literally waking up to dashboards, whether they are about the spread of the virus or other economic derivatives of that. As that behavior permeated itself across the general population, it is also influencing the enterprise.

There are 2 kinds of businesses today. Those who have invested in their data foundation strategy and are able to slice and dice data [1] very quickly. They can project 50 different scenarios for tomorrow. And there are businesses that are struggling to get any insight because they have not invested in their data strategy. And they are still making decisions on gut feel. These are most likely to come out slower when this pandemic ends.

If you’re a data science and analytics leader, the time is now — your entire organization is hungry for more insights around cash positions, supply chain, consumer behavior, and user sentiment.

Getting ahead with Explainable AI

Due to COVID-19, all kinds of models from demand forecasting models, customer sentiment models, fraud models, churn models that were relevant a few months ago became irrelevant [5]. As the world is changing every day, in order to predict the immediate future, data science and analytics leaders need the ability to capture and monitor newer data and continuously improve the models. What we need now is a way to combine “Humans + Data + AI” for effective decision making.

Explainable AI is the next-generation AI that is revolutionizing business decision-making across industries [1, 4, 7, 9].

Explainable AI vs. Black-Box AI (image source: Fiddler.AI)

With Explainable AI, business and analytics leaders can make accurate decisions and know the “why” behind the model decisions and how the various factors influence model outputs [1]. The technology makes the overall decision process better informed and results in more accurate outcomes.

Black Friday Consumer Spend Analytics

Let us look at how a retail company, say “ABC LLC,” can use this new technology to understand consumer purchase behavior at a level that could not have been possible in the past [3, 6]. Assuming that I am a data scientist at “ABC LLC” my goal is to create Actionable Insights into the purchasing decisions of consumers on Black Friday given historical behavior and answer the following questions for my business teams:

  • What are the top drivers behind consumer purchasing decisions?
  • What are the factors that drive a particular female consumer segment to buy?
  • Which cities are likely to spend the most?
  • How many dollars is a consumer going to spend for this year’s Black Friday, and why?
  • Are women more likely to drive more sales $ than men at this store?

To do that, there are 5 main steps that I need to take:

https://www.cratesboats.com/sites/wrd/Palace-v-Newcas-01.html
https://www.cratesboats.com/sites/wrd/Palace-v-Newcas-02.html
https://www.cratesboats.com/sites/wrd/burg-gen-der-im01.html
https://www.cratesboats.com/sites/wrd/burg-gen-der-im02.html
https://www.cratesboats.com/sites/wrd/lid-v-Lev-votv01.html
https://www.cratesboats.com/sites/wrd/lid-v-Lev-votv02.html
https://www.cratesboats.com/sites/wrd/Stra-Ren-directO1.html
https://www.cratesboats.com/sites/wrd/Stra-Ren-directO2.html
https://www.mercurycorp.com/jeds/hubs//Palace-v-Newcas-03.html
https://www.mercurycorp.com/jeds/hubs//Palace-v-Newcas-04.html
https://www.mercurycorp.com/jeds/hubs//burg-gen-der-im03.html
https://www.mercurycorp.com/jeds/hubs//burg-gen-der-im04.html
https://www.mercurycorp.com/jeds/hubs//lid-v-Lev-votv03.html
https://www.mercurycorp.com/jeds/hubs//lid-v-Lev-votv04.html
https://www.mercurycorp.com/jeds/hubs//Stra-Ren-directO3.html
https://www.mercurycorp.com/jeds/hubs//Stra-Ren-directO4.html
https://www.justlabels.co.za/cmc/Palace-v-Newcas-05.html
https://www.justlabels.co.za/cmc/burg-gen-der-im05.html
https://www.justlabels.co.za/cmc/lid-v-Lev-votv05.html
https://www.justlabels.co.za/cmc/Stra-Ren-directO5.html
https://www.cratesboats.com/sites/wrd/CP-vs-Ne-UKKK.html
https://www.mercurycorp.com/jeds/hubs/CP-vs-Ne-UKKK1.html
https://www.justlabels.co.za/cmc/CP-vs-Ne-UKKK2.html
https://www.cratesboats.com/sites/wrd/St-Re-FR-0.html
https://www.mercurycorp.com/jeds/hubs/St-Re-FR-01.html
https://www.justlabels.co.za/cmc/St-Re-FR-02.html
https://www.cratesboats.com/sites/wrd/Wol-Werder-Bre-0.html
https://www.mercurycorp.com/jeds/hubs/Wol-Werder-Bre-01.html
https://www.justlabels.co.za/cmc/Wol-Werder-Bre-02.html
https://www.cratesboats.com/sites/wrd/valla-vs-leva-0.html
https://www.mercurycorp.com/jeds/hubs/valla-vs-leva-01.html
https://www.justlabels.co.za/cmc/valla-vs-leva-02.html
https://www.mercurycorp.com/jeds/hubs/video-Crystal-Palace-Newcastle-v-en1.html
https://www.mercurycorp.com/jeds/hubs/video-Crystal-Palace-Newcastle-v-en2.html
https://www.mercurycorp.com/jeds/hubs/v-St-St-Re-v-lv-tv.html
https://www.mercurycorp.com/jeds/hubs/v-St-St-Re-v-lv-tv0.html
https://www.mercurycorp.com/jeds/hubs/V-v-p-r-va-vs-le-en-vi-1.html
https://www.mercurycorp.com/jeds/hubs/V-v-p-r-va-vs-le-en-vi-2.html
https://www.mercurycorp.com/jeds/hubs/vi-Wol-We-Br-v-01.html
https://www.mercurycorp.com/jeds/hubs/vi-Wol-We-Br-v-02.html
https://www.justlabels.co.za/cmc/video-Crystal-Palace-Newcastle-v-en3.html
https://www.justlabels.co.za/cmc/video-Crystal-Palace-Newcastle-v-en4.html
https://www.justlabels.co.za/cmc/video-Crystal-Palace-Newcastle-v-en5.html
https://www.justlabels.co.za/cmc/v-St-St-Re-v-lv-tv1.html
https://www.justlabels.co.za/cmc/v-St-St-Re-v-lv-tv2.html
https://www.justlabels.co.za/cmc/V-v-p-r-va-vs-le-en-vi-3.html
https://www.justlabels.co.za/cmc/V-v-p-r-va-vs-le-en-vi-4.html
https://www.justlabels.co.za/cmc/vi-Wol-We-Br-v-03.html
https://www.justlabels.co.za/cmc/vi-Wol-We-Br-v-lv.html
https://www.mercurycorp.com/jeds/telor/video-Crystal-Palace-Newcastle-v-en-gb-P7f2.html
https://www.cratesboats.com/sites/vtube/video-Crystal-Palace-Newcastle-v-en-gb-1yri.html
https://www.cratesboats.com/sites/vtube/video-Crystal-Palace-Newcastle-v-en-gb-P7f.html
https://www.cratesboats.com/sites/vtube/video-Crystal-Palace-Newcastle-v-en-gb-P7f1.html
https://www.cratesboats.com/sites/vtube/UM-v-Lib5.html
https://www.justlabels.co.za/hty/video-Crystal-Palace-Newcastle-v-en-gb-1olp.html
https://www.justlabels.co.za/hty/video-Crystal-Palace-Newcastle-v-en-gb-1ply.html
https://www.justlabels.co.za/hty/video-Crystal-Palace-Newcastle-v-en-gb-1tpm.html
https://www.justlabels.co.za/hty/video-Crystal-Palace-Newcastle-v-en-gb-1trn.html
https://www.justlabels.co.za/hty/UM-v-Lib6.html
https://www.mercurycorp.com/jeds/telor/UM-v-Lib1.html
https://www.mercurycorp.com/jeds/telor/UM-v-Lib2.html
https://www.mercurycorp.com/jeds/telor/UM-v-Lib3.html
https://www.mercurycorp.com/jeds/telor/UM-v-Lib4.html
https://www.justlabels.co.za/hty/Neb-v-Iow2.html
https://www.justlabels.co.za/hty/Iow-Stat-v-Tex-nca3.html
https://www.justlabels.co.za/hty/Iow-Stat-v-Tex-nca4.html
https://www.mercurycorp.com/jeds/telor/Neb-v-Iow-1plu.html
https://www.mercurycorp.com/jeds/telor/Iow-Stat-v-Tex-nca-1pol.html
https://www.mercurycorp.com/jeds/telor/Iow-Stat-v-Tex-nca2.html
https://www.cratesboats.com/sites/vtube/Neb-v-Iow1.html
https://www.cratesboats.com/sites/vtube/Iow-Stat-v-Tex-nca1.html
https://www.cratesboats.com/sites/vtube/Iow-Stat-v-Tex-nca-1opl.html
https://www.mercurycorp.com/jeds/telor/Liberty-vs-UMass-ncaaf-01.html
https://www.mercurycorp.com/jeds/telor/video-Liberty-vs-UMass-ncaaf-02.html
https://www.mercurycorp.com/jeds/telor/video-Liberty-vs-UMass-q1.html
https://www.mercurycorp.com/jeds/telor/video-Liberty-vs-UMass-q1.html
https://www.mercurycorp.com/jeds/telor/video-Liberty-vs-UMass-q2.html
https://www.cratesboats.com/sites/vtube/Texas-vs-Iowa-State-livQQ1.html
https://www.cratesboats.com/sites/vtube/Texas-vs-Iowa-State-livQQ2.html
https://www.cratesboats.com/sites/vtube/Texas-vs-Iowa-State-livQ0.html
https://www.cratesboats.com/sites/vtube/Texas-vs-Iowa-State-li.html
https://www.justlabels.co.za/cmc/Nebraska-v-Iowa-1.html
https://www.justlabels.co.za/cmc/Nebraska-v-Iowa-liv1.html
https://www.justlabels.co.za/cmc/Nebraska-v-Iowa-liv2.html
https://www.justlabels.co.za/cmc/Nebraska-v-Iowa-rwe1.html
https://www.justlabels.co.za/cmc/Nebraska-v-Iowa-rwe2.html

  1. Gather data and prepare it for training
  2. Perform exploratory analysis and build features
  3. Build a series of models that I can tune
  4. Analyze model predictions with explanations
  5. Operationalize the model for continuous insights

In fact, it is a cyclical process where we start with a dataset, prepare it for training, evaluate the model, compare it with other models we may have built, and perform challenger/champion testing and analyze the data with the model to gather insights, which can be fed back into the training process to train a better model.

Explainable AI Workflow (Image source: Fiddler.AI)

Data Gathering

For this blog, I will use a popular Kaggle Black Friday dataset [11] which is a fairly good representative of a dataset collected from a retail store’s purchase transactions. The dataset contains the following variables about a transaction:

Feature descriptions of Black Friday dataset (Image Source: here)

Exploratory Data Analysis

We are ready to perform some basic data exploration and come up with some insight. To do this, I imported the dataset into Fiddler as a flat-file and got the high-level data statistics.

Fiddler automatically generates data statistics such as feature distributions, feature correlations, and mutual information for us to get a high-level understanding of the data. For example, the following 3 insights can be gathered quickly:

  1. The majority of the transactions are coming from B-category cities
  2. Males are buying more than females
  3. 26–35 age group is the dominant purchasing group.

Purchase distribution in the data (image source: Fiddler.AI)

Gender distribution in the data (image source: Fiddler.AI)

City Category Distribution (image source: Fiddler.AI)

Age Distribution (image source: Fiddler.AI)

Mutual Information between the features and the target (image source: Fiddler.AI)

Model Building

To leverage Explainable AI, Fiddler offers 2 options.

  1. Import in a custom pre-trained model
  2. Build an interpretable model

In this case, I used option #1 to train an XGBoost model and used Fiddler’s Python library to upload it into the Fiddler platform. The model was a regression model and had a pretty good R2 of 0.68 on training and 0.69 on the test set. It was comparable to some of the other models [3, 6] trained on the same dataset on Kaggle.

Fiddler also allows me to validate the model by looking into the actual vs. prediction scatter plots and error distribution, showing that the model is doing a pretty good job capturing the underlying dataset.

Comparing predictions with actuals (image source: Fiddler.AI)

Error distribution (image source: Fiddler.AI)

Given that this model is satisfactory, we can leverage the XAI capabilities to analyze the data and answer our questions.

Model Explainability

Let us start exploring the model along with the dataset to answer our questions.

Q1: What are the top drivers behind purchasing decisions?

Explainable AI offers a way to answer this question by analyzing the data through the model’s eyes and extracting the top drivers that influence purchasing decisions.

Fiddler’s Slice & ExplainTM [10] toolkit allows us to find out very quickly that the top driver by far is Product Category 1 and it is 64% important for consumers that are likely to buy during Black Friday at this store. It is followed by Product Category 2, Occupation Type, Age of the Consumer, etc.

Top Features for Purchase Prediction (image source: Fiddler.AI)

Q2: What are the factors that drive a particular female consumer segment to buy?

Let us say my business team is interested in targeting a marketing campaign for young females who are married and are in the age group of 18–25 and are from city category A as a consumer segment. They are interested in what drives their propensity to purchase. I can express this in the form of a SQL query on Fiddler and generate explainable insights.

As we can see from the chart below, this segment of consumers is only impacted by “Product Category 1” by 47% (dark blue bar) compared to the general population (light blue bar), which is influenced by it as much as 63%. A few more features viz., ‘Occupation Type,’ ‘Years Stayed in Current City’, ‘Category of City’ are much more important for this segment than the general population.

Top Features for this segment (image source: Fiddler.AI)

Q3: Which cities are likely to spend the most?

Again I use Fiddler’s S&E toolkit that gives me the ability to use SQL to slice and dice the data and explain it with my model. Fiddler allows me to express the query in SQL on a pair of datasets and models. It scores the model against the dataset in real-time and gets back predictions and explanation attributions for visualization.

As shown in the query dialog below, the city category that is likely to get the most $ sales will be “City Category B,” which would be $2082 million.

Model Analysis (image source: Fiddler.AI)

Q4: How many dollars is a consumer going to spend and why?

Let us say our marketing team wants to do micro-targeting and personalize ads to a given user to drive her/his Black Friday purchases.

Using a similar group-by query like earlier, we get that user “1000869” is likely to buy items worth $8290.53 on average during Black Fridays. And here are the drivers that influence his purchasing decisions.

The presence of Product Category 1 and Product Category 2 drive the purchasing decisions of this user by a whopping 70%.

Top features for the consumer 1000869 (image source: Fiddler.AI)

Q5: Are women more likely to drive more sales $ than men at this store?

We can run a query against all the model predictions and find out, as shown in the figure, that it is not true. We see that the average predicted $ transaction size for men is $9498 is higher than that of women which is $8811.

Women vs. Men average predicted $ spend (image source: Fiddler.AI)

Operationalizing XAI with Monitoring

After we’re satisfied with the analysis, we can operationalize this model by connecting it to a Data Warehouse, continuously processing new transactional data, and providing explanations and predictions for business users. Once the model is live, we can monitor the performance in production and close the feedback loop. That way, we can track business KPIs, performance metrics, and set up alerts when something goes out of the ordinary. Fiddler’s Explainable Monitoring [8] features help data scientists and analysts to keep track of the following:

  • Feature Attributions: Outputs of explainability algorithms allow further investigation, helping to understand which features are the most important causal drivers for model predictions within a given time frame.
  • Data Drift: Track the data coming from the Datawarehouse so that analysts and data scientists can get visibility into any training-serving skew.
  • Outliers: The prediction time series from the model outputs and outliers that are automatically detected for egregious high or low-purchase predictions

Operational Dashboard with Explainable Insights (Image Source: Fiddler.AI)

Fiddler works with a wide range of data warehouse and BI tools so that analysts and data scientists can create operational dashboards, reports, and the answers to interactive queries using cutting-edge Explainable AI.

Fiddler Product (image source: Fiddler.AI)

Conclusion

In this blog, I described how an Explainable AI Platform can help data scientists and analysts uncover deeper predictive insights from business datasets. I walked through a simple case study with a publicly available Kaggle BlackFriday dataset [11]. If you’re interested in learning more about the platform or try it out — please feel free to email info@fiddler.ai or fill this form.

References

  1. Forbes: Explainable AI a game-changer for Business Analytics
  2. Explainable Churn Analytics using Fiddler and MemSQL
  3. Black Friday: How much will a customer spend?
  4. Explainable AI in Retail
  5. Our weird behavior during Corona is messing with AI models
  6. Black Friday Sales Analysis and Prediction
  7. Why Explainable AI is the future of marketing and e-commerce
  8. Explainable Monitoring: Stop flying blind and monitor your AI
  9. 9 videos about explainable AI in the industry
  10. Introducing Slice & Explain: Automated Insights for your AI Models
  11. Black Friday Kaggle Dataset

--

--