1. DATA MINING AND WARE HOUSING
(FP GROWTH ALGORITHM EXAMPLE)
MADE BY: MANISH MESHRAM (203441006) GUIDED BY:
DR.DIPALI MEHER
SHREYA KALEKAR (203441009)
SWATI BOTE (203441015)
YASH CHITNIS (203441020)
VINAY BHOSALE (203441027)
MODERN COLLEGE OF ARTS, SCIENCE &
COMMERCE, GANESHKHIND.
DEPARTMENT: COMPUTER SCIENCE(M.Sc.
I (CA))
2. •FP Growth Algorithm (Frequent pattern
growth). FP growth algorithm is an improvement
of Apriori algorithm. FP growth algorithm used
for finding frequent itemset in a transaction
database without candidate generation.
•FP growth represents frequent items in frequent
pattern trees or FP-tree.
3. Apply the FP tree algorithm for the
given transactional database with the
minimum support of 4.
Transaction ID List of Items
T1 Milk, Bread, Butter
T2 Bread, Milk
T3 Sugar, Milk, Bread
T4 Bread, Butter
T5 Bread, Butter, Milk
T6 Milk, Sugar
T7 Milk, Bread, Butter
T8 Milk, Butter
4. STEP 1: Find out the frequency of
occurrence of each item in the database.
ITEMS FREQUENC
Y
Milk 7
Bread 6
Butter 5
Sugar 2
Transaction
ID
List of
Items
T1 Milk, Bread,
Butter
T2 Bread, Milk
T3 Sugar, Milk,
Bread
T4 Bread, Butter
T5 Bread, Butter,
Milk
T6 Milk, Sugar
Table2: Frequency of
occurrence
Table
1
Table
2
5. STEP 2: Prioritize the item. Give the priority to
each item according to its frequency of
occurrence.
ITEMS FREQUENCY
Milk 7
Bread 6
Butter 5
Sugar 2
Table
2 ITEMS FREQUENCY
Milk 7
Bread 6
Butter 5
Sugar 2
PRIORITY
1
2
3
4
Table
3
6. STEP 3: Order the items according to the
priorities in a tabular format.
Transaction
ID
List of Items
T1 Milk, Bread,
Butter
T2 Bread, Milk
T3 Sugar, Milk, Bread
T4 Bread, Butter
T5 Bread, Butter,
Milk
T6 Milk, Sugar
T7 Milk, Bread,
Ordered
Items
Milk, Bread,
Butter
Milk, Bread
Milk, Bread,
Sugar
Bread, Butter
Milk, Bread,
Butter
Milk, Sugar
Table
4
New version of
Table 1
1
2
3
4
7. STEP 4: Order the items according to
priority in an FP Tree format.
• Row 1: Lets take the
items of row 1 (Milk: M,
Bread: BR, Butter: B)
and arrange them one
by one respectively. All
FP Tree have a “null”
node and a “root”
node.
NUL
L
M:1
BR:
1
B:1
8. CONTINUE UPDATING THE TREE
• Row 2: Lets take the
items of row 2(Milk:
M, Bread: B).
Continue updating
the occurrence of
the items.
NULL
M:2
BR:
2
B:1
9. CONTINUE UPDATING THE TREE
• Row 3: Lets take the
items from the third
row( Milk: M, Bread: BR,
Sugar: S). Here new root
node will be created
which will connect ‘BR’
i.e., ‘S’. Update the
occurrence of the items.
NUL
L
M:3
BR:
3
B:1 S:1
10. CONTINUE ADDING THE ITEMS FROM THE
FORTH ROW
• Row 4: Lets take the
items from the forth
row(Bread: BR, Butter: B).
Here new root node will
be generated from the
null node. Write the
occurrence of the items
as well.
NULL
M:3
BR:3
B:1 S:1
BR:
1
B:1
11. CONTINUE ADDING THE ITEMS IN THE TREE
• Row 5: Lets add the
items from the fifth
row( Milk: M, Bread:
BR, Butter: B ). It will
continue with the
previous node it self
only the occurrence of
the items will be
changed.
NUL
L
M:4
BR:4
B:2 S:1
BR:1
B:1
12. CONTINUE ADDING THE ITEMS IN THE TREE
• Row 6: Lets add the items
from the sixth row( Milk: M,
Sugar: S). Item Sugar will be
added to the Milk node that
means a new node will be
generated.
NUL
L
M:5
BR:4
B:2 S:1
S:1
BR:1
B:1
13. KEEP ON ADDING THE ITEMS OF THE
SEVENTH ROW
• Row 7: Lets take the
items of seventh row
(Milk: M, Bread: BR,
Butter: B). It will continue
in the previous nodes
itself. Only the
occurrences will be
increased.
NULL
M:6
BR:5
B:3
S:1
S:1
BR:1
B:1
14. KEEP ON ADDING THE ITEMS OF THE LAST
ROW
• Row 8: Lets add the
items from the eight
row( Milk: M, Butter:
B). Item Butter will be
added to the Milk
node that means a
new node will be
generated.
NUL
L
M:7
BR:5
B:1
B:3
S:1
S:1
BR:1
B:1
FINAL FP
TREE
15. STEP 5: VALIDATION
• To know whether the FP Tree is correct or not.
• Check the count of frequency of occurrence of each
item with the help of Table 2.
• If the frequency of the both Table and Tree matches
then the FP Tree is correct.
16. COUNT THE FREQUENCY OF OOCURRENCE
ITEMS FREQUENC
Y
Milk 7
Bread 6
Butter 5
Sugar 2
Table
2
NUL
L
M:7
B:1 BR:5 S:1
B:3 S:1
BR:1
B:1