14. Visualizing Shopper Behavior

 
Subtitles Enabled

Sign up for a free trial to access more free content.

Free trial

Overview

In this, the final lesson on Market Basket analysis, we use Tableau to create a scatterplot of the item sets with reference to lift, support, and confidence.

Lesson Notes

Developing an XY Chart

  • In order to develop our chart, we need to create a level of detail expression to ensure that Lift is correctly calculated
  • The XY chart breaks down likely item associations for male and female shoppers, allowing us to visualize each individual rule

Transcript

Over the past two lessons, we've created rules for our data set with our market basket rules tool and run the association analysis with the market basket inspect tool.

Our goal in this lesson is to visualize the output of our analysis. We'll achieve this goal through three key steps.

We'll start by importing our data to Tableau and organizing the fields.

We'll then inspect our data and ensure that lift is calculated correctly.

As a final step, we'll create an XY chart that visualizes associated purchases. As with lesson 11, this lesson assumes you have a solid understanding of Tableau.

If you need a refresher, please review our Tableau courses.

We'll start by opening Tableau and connecting our data set.

We'll open up a new sheet. Right click on LHS and create a new hierarchy.

We'll then add the LHS category 1, LHS category 2 and LHS category 3 fields.

We'll right click on RHS.

Create another hierarchy and add RHS category 1, category 2 and category 3.

Now that we've imported and organized the data set, we're ready to move on to the second step and inspect the data.

We'll bring LHS full, LHS category 3, and RHS category 3 to the row shelf.

We can see that our separated LHS items are listed together with their associated RHS items.

If we now bring lift to the column shelf, we can see that a sum of lift in each case represents the lift of the item set. However, if we remove the LHS category 3 column from the row shelf, we can see that the sum of our lifts is miscalculated. Instead, we need to calculate the appropriate proportion of lift for each of our LHS items. We can do this by creating a new calculated field.

We'll create the field and call it lift proportion.

We'll then enter the formula lift divided by open curly bracket fixed LHS full colon count LHS closed curly bracket.

This level of detail expression fixes the problem by ensuring the LHS full field is not affected when we adjust the dimensions in the visualization. We'll press okay to create the field. At this point, we'll move on to step 3 and create our XY chart. This XY chart will apply rule associations for male and female shoppers by average of confidence and the average of lift.

The size of the specific points will vary based on the lift for the associated rules.

As a result, we'll have all three major market basket metrics on the same chart.

The Tableau formatting here might be a bit quick so don't worry if you can't follow along.

The main point here is to show you just one option for visualizing this data.

We'll create a new sheet, move the measure support to the column shelf.

Change it to an average.

Move the measure confidence to the row shelf and again, change it to an average. We'll then move our LHS category 1 to the colors area of the mark shelf. And gender, to the shapes area.

We'll change the shapes so they better represent the gender options in our data set.

We'll also double click on both axis and choose not to display zero in either.

Next, we'll move LHS full, RHS and day to the detail area and the measure lift proportion to size.

To aid with our analysis, we'll move LHS category 1 and RHS category 1 to the filter shelf.

We'll display both filters and choose to view each as a single value drop down.

Finally, we'll also move RHS to the filter shelf and again display this filter on the side bar.

We are now presented with 4729 associations or item sets.

For example, weekday male customers who purchase bananas and eggs are 81% likely to purchase fresh milk with a lift of just 1.25.

In a previous lesson, we discovered that the most frequently bought items are fresh milk and sweets chocolate.

For this reason, it might be a good idea to exclude these items as they're present in most baskets.

We can do this by deselecting fresh milk and sweets chocolate from the RHS filter.

Let's now filter by LHS category 1 fresh food and RHS category 1 food cupboard.

We can see that male customers who buy fresh milk, frozen chips, potatoes, onion rings, potatoes are 62.5% likely to purchase mixes pourover sauces on the weekend with a lift of 11.18.

Perhaps we could put together a special offer together for these customers bundling these products as a Friday, Saturday night special. It's easy to see that a treasure trove of useful information can be obtained from an association analysis.

Indeed, this data could be further augmented by overlying age information and other attributes.

This concludes our course on the market basket and AB testing capabilities in Alteryx.

As we've seen through our lessons, these tools allow you to gain much more insight from the available data. In the next course, we'll at how Alteryx can help you obtain data from various websources.