Skip to content
StackDecode
AI & ML Atlas
Machine LearningalgorithmAnimated walkthrough

FP-Growth Algorithm

Finds frequent itemsets from a compact prefix tree, with no candidate generation.

The idea

It scans the data twice. It first counts items, then inserts each transaction (items sorted by frequency) into an FP-tree, where shared prefixes share nodes. Frequent itemsets are mined by recursively exploring the tree's conditional pattern bases, avoiding Apriori's huge candidate lists.

Watch it run

The pipeline lights up one step at a time. Use the controls to pause or step through it.

  1. 1Count item frequencies and drop the infrequent ones.
  2. 2Sort each transaction's items by frequency.
  3. 3Insert the transactions into a prefix tree, sharing common prefixes.
  4. 4For each item, collect its prefix paths and build a conditional tree.
  5. 5Recurse to output the frequent itemsets.
1/5

Step by step

  1. 1Count item frequencies and drop the infrequent ones.
  2. 2Sort each transaction's items by frequency.
  3. 3Insert the transactions into a prefix tree, sharing common prefixes.
  4. 4For each item, collect its prefix paths and build a conditional tree.
  5. 5Recurse to output the frequent itemsets.

Where it is used

Faster basket analysis on large, dense data.

Watch out for

The tree can be big if there is little shared structure.

Related