by Ryan Harrington

Predictive analytics and data mining can be used for many different purposes. Last week we discussed cluster analyses, a group of techniques that can help businesses to better identify their customer segments (among many other things). This week we move on to a group of techniques that would be of interest for companies that sell many products, especially those in a retail environment: association rules.

So, what are association rules?

Let’s pretend that you run a convenience store. You sell many different products – from milk and eggs to soda and candy bars. You have records for all of your customer’s transactions for the past several years. You have an understanding of what your customers are buying most often (not shockingly, it’s milk), but you’re really curious about what customers are buying together.

This is the value of association rules in predictive analytics. Association rules help us to predict the occurrence of one item based on the occurrence of other items in the transaction. In our convenience store example, association modeling could help us to discover that people who buy milk are often buying bread and eggs at the same time. While this example is simple and intuitive, it can help to uncover patterns that you might not have noticed before.

A frequently discussed data science story relates the story of a chain of grocery stores that was interested in finding patterns within their customers’ buying habits. They analyzed different customer segments for different purchasing time periods, performing association analyses. They discovered a particularly interesting insight. Men in their thirties who were making purchases between 5 pm and 7 pm on weekdays and bought diapers were much more likely to have beer in their cart as well. The grocery chain used this information by moving the diaper aisle closer to the beer aisle, leading to an immediate boost in sales.

You’re likely already familiar with some high level applications of what association rules modeling looks like without realizing it. If you’ve ever bought a recommended product on Amazon, watched a show that Netflix thinks you’ll like, or listened to music on Pandora, then you’ve seen association modeling at work. Each of these recommendation engines is powered (at least at some level) by association modeling. The modeling that each of these companies performs is closely tied to their core business functions.

How does association modeling work?

Association modeling is done through analysis of transactions. A transaction does not need to be a literal transaction, such as in retail, but could also be something such as information from an incident report. Data is arranged so that each “transaction” is paired with the items from that transaction.

One of the most important steps that must be taken for association rules is determining the minimum support and minimum confidence required for the analysis. The support tells us how often a given rule is applicable for a dataset, whereas the confidence tells us how frequently one item occurs in a transaction that contains another item. Most importantly, these two criteria act as a filter for the number or rules that will be returned. This is because even a small number of items in a transaction generates an enormous number of possible rules.

Let’s consider this example. Imagine that your store sells only 5 items: milk, bread, candy, soda, and eggs. With just those 5 items, you would have to analyze 180 association rules. If you add in just one more item, perhaps chips, there are now 602 possible association rules. By the time you’re analyzing 10 items (water bottles, chewing gum, mints, and slushies), there are already 57,002 possible association rules. Many of these rules will be useless. They’ll have low support and low confidence. They are merely the result of chance, but do not represent a fundamental reality about the transactions that are occurring.

With this in mind, data scientists think about association rule modeling in a few broad steps:

  1. Generate a Frequent Itemset
    All of the possible itemsets that meet the minimum support criteria are determined. This allows for an immediate filter on top of the data.
  2. Determine Rules
    High-confidence items are determined from the items that meet the minimum support criteria. These rules are called strong rules.
  3. Determine Lift
    A classic method for determining how useful a rule that is generated through association modeling is lift. This tells a data scientist which rules might be of most value. For example, the grocery store chain that determined that customers that bought diapers are likely to buy beer would have selected this rule because of its high lift.

My company isn’t involved in retail. How can we use association rules modeling?

While retail is perhaps one of the most common industries for association rules modeling to be used in, there are plenty of others:

Like any predictive analytics technique, association rules modeling can be applied to a wide range of scenarios and industries. The only limiting factor is creativity. When paired with other analytics methods, the possibilities for analytics are nearly endless.

Next week, we’ll take a look at the last item in the predictive analytics toolset: predictive analysis. This is a broad range of analytics that covers techniques that range from predicting future values to classifying incidents. This set of techniques is one of the most useful for businesses looking to utilize predictive analytics in their practice.

Looking to analyze your products? Perhaps you want to understand your web logs better? Reach out to us and we can get you pointed in the right direction.

AuthorRyan Harrington