Docsity

FP-Tree Construction: An Example and Its Application in Data Mining, Essays (university) of Data Mining

Partial preview of the text

Download FP-Tree Construction: An Example and Its Application in Data Mining and more Essays (university) Data Mining in PDF only on Docsity!

Preprocessing Association

Mining Association Rules

Frequent Itemset Generation

Generate all item sets whose support ≥ 𝑚𝑖𝑛𝑠𝑢𝑝

Rule Generation

Generate high confidence (strong) rules from each

frequent itemset

Recall the two-step Approach:

Expensive

Preprocessing Association

Frequent Itemset Generation

Reduce the number of comparisons by using advanced

data structures to store the candidate itemsets or to

compress the dataset → FP-Growth

Several ways to reduce the computational complexity:

Preprocessing Association

FP-Tree Representation

• An FP-tree is a compressed representation of the

input.

• It is constructed by reading the dataset one

transaction at a time and mapping each transaction

onto a path in the FP-tree.

• The more the paths overlap with one another, the

greater the compression that can be achieved.

Example of FP-Tree Construction

• Consider the dataset to the left.

  • Ten total transactions or itemsets.
  • Five total items (𝑎, 𝑏, 𝑐, 𝑑, and 𝑒). TID Items 1 a, b 2 b, c, d 3 a, c, d, e 4 a, d, e 5 a, b, c 6 a, b, c, d 7 a 8 a, b, c 9 a, b, d 10 b, c, e

Example of FP-Tree Construction

A second pass over the dataset is used to

construct the FP-tree. After reading the first

transaction, a, b , the nodes 𝑎 and 𝑏 are

created. A path is then formed from

null → 𝑎 → 𝑏 to encode the transaction.

Every node along the path has a frequency

count of 1.

TID Items 1 𝐚, 𝐛 2 b, c, d 3 a, c, d, e 4 a, d, e 5 a, b, c 6 a, b, c, d 7 a 8 a, b, c 9 a, b, d 10 b, c, e

null a: b:

Example of FP-Tree Construction

After reading the second transaction,

b, c, d , a new set of nodes is created for

items 𝑏, 𝑐, and 𝑑. A path is formed to

represent the transaction by connecting

8 nodes null → 𝑏 → 𝑐 → 𝑑.

TID Items 1 a, b 2 𝐛, 𝐜, 𝐝 3 a, c, d, e 4 a, d, e 5 a, b, c 6 a, b, c, d 7 a 8 a, b, c 9 a, b, d 10 b, c, e

null a: b: d: c: b:

Preprocessing Association

Example of FP-Tree Construction

TID Items 1 a, b 2 b, c, d 3 a, c, d, e 4 𝐚, 𝐝, 𝐞 5 a, b, c 6 a, b, c, d 7 a 8 a, b, c 9 a, b, d 10 b, c, e null a: b: e: d: c: d: c: b:

5 And the tree grows…

e: d:

Preprocessing Association

Example of FP-Tree Construction

TID Items 1 a, b 2 b, c, d 3 a, c, d, e 4 a, d, e 5 𝐚, 𝐛, 𝐜 6 a, b, c, d 7 a 8 a, b, c 9 a, b, d 10 b, c, e null a: b: e: d: c: d: c: b:

6 And grows…

c: e: d:

Preprocessing Association

Example of FP-Tree Construction

TID Items 1 a, b 2 b, c, d 3 a, c, d, e 4 a, d, e 5 a, b, c 6 a, b, c, d 7 𝐚 8 a, b, c 9 a, b, d 10 b, c, e

8 And grows…

null a: b: e: d: c: b: c: d: c: e: d: d:

Preprocessing Association

Example of FP-Tree Construction

TID Items 1 a, b 2 b, c, d 3 a, c, d, e 4 a, d, e 5 a, b, c 6 a, b, c, d 7 a 8 𝐚, 𝐛, 𝐜 9 a, b, d 10 b, c, e

9 And grows…

null a: b: e: d: c: b: d: c: d: c: e: d:

Preprocessing Association

Example of FP-Tree Construction

TID Items 1 a, b 2 b, c, d 3 a, c, d, e 4 a, d, e 5 a, b, c 6 a, b, c, d 7 a 8 a, b, c 9 a, b, d 10 𝐛, 𝐜, 𝐞 null a: b: c: d: d: e: d: c: d: d: e: c: b: e:

11 And finally stops.

Preprocessing Association

Example of FP-Tree Construction

TID Items 1 a, b 2 b, c, d 3 a, c, d, e 4 a, d, e 5 a, b, c 6 a, b, c, d 7 a 8 a, b, c 9 a, b, d 10 b, c, e null a: b: c: d: d: e: d: c: d: d: e: c: b: e:

The Final FP-Tree

Preprocessing Association

Notes on FP-Tree Construction

19 TID Items 1 a, b 2 b, c, d 3 a, c, d, e 4 a, d, e 5 a, b, c 6 a, b, c, d 7 a 8 a, b, c 9 a, b, d 10 b, c, e null e: d: c: a: a: b: a: c: b: a: a: a: a: c: c: b: b: b: d:

  • The size of an FP-tree also

depends on how the items

are ordered.

The Final FP-Tree

(Items sorted from lowest to highest support)

Preprocessing

Association

FP-Tree Comparison

null

The Final FP-Tree

Items sorted from lowest to highest support Items sorted from highest

 - a: null - b: 
  • c:
  • d: - d: - e: - d: - c: - d: - d: - e: - c: - b: - e: - e: - d: - c: - a: - b: - c: - b: - a: - a: - a: - a: - c: - c: - b: - b: - b: - d: