Congratulations!

Market Basket Analysis in Python

Isaiah Hull

Visiting Associate Professor of Finance, BI Norwegian Business School

Transactions and itemsets

  • Transactions
TID Transaction
1 MILK, BREAD, BISCUIT
... ...
20 TEA, MILK, COFFEE, CEREAL
  • Itemsets
    • {MILK, BREAD}
    • {MILK, COFFEE, CEREAL}
Market Basket Analysis in Python

Association rules and metrics

  • Association Rules
    • Use if-then structure.
      • If A then B.
    • Have antecedent(s) and consequent(s).
    • Many association rules.
  • Metrics
    • Measure strength of association.
      • Support, lift, confidence, conviction
    • Used to prune itemsets and rules.
Market Basket Analysis in Python

Pruning and aggregation

The diagram shows a list of items, some of which have been crossed out to indicate that they've been pruned.

The diagram shows a list of items being mapped to a smaller list to indicate that

Market Basket Analysis in Python

The Apriori algorithm

The figure shows an illustration of the Apriori algorithm.

Market Basket Analysis in Python

Visualizing rules

This figure shows an example of a heatmap visualization of association rules.

This figure shows an example of a scatterplot visualization of association rules.

This figure shows an example of a parallel coordinates plot visualization of association rules.

Market Basket Analysis in Python

Congratulations!

Market Basket Analysis in Python

Preparing Video For Download...