Patterns › Association rules

Association rules (market basket)

Association-rule mining finds "customers who bought A also bought B" patterns in basket data, scoring each rule by support, confidence and lift.

What is Association rules (market basket)?

The Apriori algorithm (Agrawal & Srikant, 1994) searches for itemsets that appear together often enough to matter, then turns each into rules. It is made tractable by downward closure: every subset of a frequent itemset is itself frequent, so candidates of size k are built only from frequent sets of size k-1 and anything with an infrequent subset is discarded before its support is ever counted.

Three numbers describe a rule and they answer different questions. Support is how often the whole combination occurs — a rule with tiny support may be real but is rarely worth acting on. Confidence is how often the consequent follows the antecedent. Lift compares that confidence to the consequent's own base rate: lift near 1 means the rule is telling you nothing except that the item is popular.

When should I use Association rules (market basket)?

  • Retail basket analysis — which products are bought together.
  • Any co-occurrence question: symptoms recorded together, codes appearing on the same claim, features used in the same session.
  • Exploring a wide table of yes/no indicators for combinations worth a closer look.

What data does it need?

Either one row per basket with a column per item (any non-blank, non-zero value counts as present), or one row per basket-item pair with a basket id and an item column.

What does it report?

Each rule with its support, confidence, lift and transaction count, sorted by lift, plus the most frequent individual items.

What does it assume?

  • Transactions are independent.
  • Order within a basket is ignored — only co-occurrence matters.
  • Quantities are ignored: buying six of an item is the same as buying one.

See also

References

  • Agrawal & Srikant (1994). Fast algorithms for mining association rules. VLDB.