Apriori Algorithm and Association Rules
Explore the Apriori Algorithm and association rule mining to identify frequent itemsets and relationships within datasets. Understand key evaluation metrics such as support, confidence, and lift, and see how these concepts apply in market basket analysis and other fields.
Association Rule Mining
Association Rule Mining helps us find rules and relationships in the dataset. It works for both relational databases and transactional databases. It is also used to find the correlated features with each other. An association rule has two parts: antecedent and consequent. An antecedent is found in the dataset at hand and a consequent is found by using the antecedent. One such example of association rule is:
and are called antecedents and consequent, respectively. It can be read as: People who buy diapers are also likely to buy beer. “Diaper” and “beer” are the items. This rule has been deduced out of a dataset. This rule can help the companies to increase revenue and make smart decisions based on it.
Metrics for Evaluating Association Rules
There are various metrics involved in evaluating the Interest of Association Rules. Association Rules are carefully derived from the dataset. Let us consider the following transactional table.
| Transactional ID | Items |
|---|---|
| 1 | Bread, Milk |
| 2 | Bread, Diaper,Bear Eggs |
| 3 | Milk, Diaper, Beer, Coke |
| 4 | Bread, Milk, Diaper, Beer |
| 5 | Bread, Milk, Diaper, Coke |
Support
Support tells us about how frequent or popular an itemset is, as measured by the proportion of transactions in which an itemset appears. It is a value between 0 and 1. Values closer to 1 show that itemsets occur more frequently in the dataset. We refer to an itemset as a frequent itemset if support is larger than a specified minimum-support threshold. In the above table, we have:
There are a total of five transactions, and out of those three have the item beer appearing in them.
...