liveBook · Manning

Frequent pattern tree

As explained in Data Without Labels

A frequent pattern tree is a prefix-tree representation of transaction data in which shared item sequences are merged and node counts record item frequencies.

A frequent pattern tree (FP tree) represents transaction data as a prefix tree. Shared item sequences are merged, while node counts record item frequencies, reducing the need to generate candidate item sets. section 4.6 section 4.11

Construct an FP tree by following these steps:

  • Scan all transactions and count each item's occurrences, producing support counts. section 4.6
  • Order items by descending frequency; break equal-frequency ties arbitrarily. section 4.6
  • Create a NULL root, then insert each transaction in frequency order, extending existing paths and increasing their counts. section 4.6
  • Derive conditional pattern bases and conditional FP trees to generate frequent patterns. section 4.6

Nine-transaction grocery dataset

For transactions containing Apples, Milk, Eggs, Cheese, and Bread, the support counts are Milk 7, Apples 6, Bread 6, Cheese 2, and Eggs 2. Milk therefore leads the initial branch; later transactions reuse shared paths and increment node counts.

How Data Without Labels covers it

How deep it goes
Explains counting, ordering, insertion, path reuse, and conditional trees, but does not detail implementation code or complexity.
Examples
Uses nine grocery transactions with Apples, Milk, Eggs, Cheese, and Bread, plus a completed tree and conditional-pattern tables.
What it assumes
Assumes transaction records and support counts; teaches tree construction and frequent-pattern extraction from the initial scan.
What you can do after
Apply it by counting supports, constructing a compressed tree, and deriving frequent patterns through conditional FP trees.
How it connects
Connects frequent pattern trees to association rules, Apriori, frequent item sets, conditional pattern bases, and conditional FP trees.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Without Labels. The section links point to the parts of the book it draws on.