FP-Tree Growth Algorithm
FP-Tree Growth Algorithm
Bachelor of Technology
Computer Science and Engineering
Submitted By
OCTOBER 2019
1. Abstract
2. Introduction
3. Body
i. FP-Tree Structure
ii. FP-Growth Algorithm
iii. FP-Growth Algorithm Variations
4. Conclusion
5. References
ABSTRACT
In Data Mining the task of finding frequent pattern in large databases is very important and has
been studied in large scale in the past few years. Unfortunately, this task is computationally
expensive, especially when a large number of patterns exist.
The FP-Growth Algorithm, proposed by Han in, is an efficient and scalable method for mining
the complete set of frequent patterns by pattern fragment growth, using an extended prefix-tree
structure for storing compressed and crucial information about frequent patterns named
frequent-pattern tree (FP-tree). In his study, Han proved that his method outperforms other
popular methods for mining frequent patterns, e.g. the Apriori Algorithm and the TreeProjection.
In some later works it was proved that FP-Growth has better performance than other methods,
including Eclat and Relim. The popularity and efficiency of FP-Growth Algorithm contributes
with many studies that propose variations to improve his performance.
INTRODUCTION
One of the currently fastest and most popular algorithms for frequent item set mining is the
FP-growth algorithm. It is based on a prex tree representation of the given database of
transactions (called an FP-tree), which can save consid- erable amounts of memory for storing
the transactions. The basic idea of the FP-growth algorithm can be described as a recursive
elimination scheme: in a preprocessing step delete all items from the transactions that are not
frequent individually, i.e., do not appear in a user-specied minimum number of transactions.
Then select all transactions that contain the least frequent item (least frequent among those that
are frequent) and delete this item from them. Recurse to process the obtained reduced (also
known as projected) database, remembering that the item sets found in the recursion share the
deleted item as a prex. On return, remove the processed item also from the database of all
transactions and start over, i.e., process the second frequent item etc. In these processing steps
the prex tree, which is enhanced by links between the branches, is exploited to quickly nd the
transactions containing a given item and also to remove this item from the transactions after it
has been processed.
In simple words, this algorithm works as follows: first it compresses the input database creating
an FP-tree instance to represent frequent items. After this first step it divides the compressed
database into a set of conditional databases, each one associated with one frequent pattern.
Finally, each such database is mined separately. Using this strategy, the FP-Growth reduces the
search costs looking for short patterns recursively and then concatenating them in the long
frequent patterns, offering good selectivity.
In large databases, it’s not possible to hold the FP-tree in the main memory. A strategy to cope
with this problem is to firstly partition the database into a set of smaller databases (called
projected databases), and then construct an FP-tree from each of these smaller databases.
FP-TREE STRUCTURE
The frequent-pattern tree (FP-tree) is a compact structure that stores quantitative information
.
about frequent patterns in a database [4]
Han defines the FP-tree as the tree structure io below
➢ One root labeled as “null” with a set of item-prefix subtrees as children, and a
frequent-item-header table
➢ Each node in the item-prefix subtree consists of three fields:
○ Item-name: registers which item is represented by the node;
○ Count: the number of transactions represented by the portion of the path reaching
the node;
○ Node-link: links to the next node in the FP-tree carrying the same item-name, or
null if there is none.
By using this algorithm, the FP-tree is constructed in two scans of the database. The first scan
collects and sort the set of frequent items, and the second constructs the FP-Tree.
FP-GROWTH ALGORITHM
After constructing the FP-Tree it’s possible to mine it to find the complete set of frequent
presents a group of lemmas and properties, and
patterns. To accomplish this job, Han in [1]
thereafter describes the FP-Growth Algorithm as presented below in Algorithm 2.
Algorithm 2: FP-Growth
(03) let Q be the multipath part with the top branching node replaced by a null root;
(10) construct ß’s conditional pattern-base and then ß’s conditional FP-tree Tree ß;
(14) return(freq pattern set(P) ∪ freq pattern set(Q) ∪ (freq pattern set(P) × freq pattern
set(Q)))
When the FP-tree contains a single prefix-path, the complete set of frequent patterns can be
generated in three parts: the single prefix-path P, the multipath Q, and their combinations (lines
01 to 03 and 14). The resulting patterns for a single prefix path are the enumerations of its
subpaths that have the minimum support (lines 04 to 06). Thereafter, the multipath Q is defined
(line 03 or 07) and the resulting patterns from it are processed (lines 08 to 13). Finally, in line 14
the combined results are returned as the frequent patterns found.
Example
This section presents a simple example to illustrate how the previous algorithm works.
i(t)
1 ABDE
2 BCE
3 ABDE
4 ABCE
5 ABCD
E
6 BCD
To build the FP-Tree, frequent items support are first calculated and sorted in decreasing order
resulting in the following list: { B(6), E(5), A(4), C(4), D(4) }. Thereafter, the FP-Tree is
iteratively constructed for each transaction, using the sorted list of items as shown in Figure 2.
As presented in Figure 3, the initial call to FP-Growth uses the FP-Tree obtained from the
Algorithm 1, presented in Figure 2 (f), to process the projected trees in recursive calls to get the
frequent patterns in the transactions presented before.
Using a depth-first strategy the projected trees are determined to items D, C, A, E and B,
respectively. First the projected tree for D is recursively processed, projecting trees for DA, DE
and DB. In a similar manner the remaining items are processed. At the end of process the
frequent itemset is: { DAE, DAEB, DAB, DEB, DA, DE, DB, CE, CEB, CB, AE, AEB, AB, EB
}.
DynFP-Growth Algorithm
The DynFP-Growth, has focused in improving the FP-Tree algorithm construction based on two
observed problems:
1. The resulting FP-tree is not unique for the same “logical” database;
2. The process needs two complete scans of the database.
To solve the first problem Gyorödi C., et al. proposes the usage of a support descending order
together with a lexicographic order, ensuring in this way the uniqueness of the resulting FP-tree
for different “logically equivalent” databases. To solve the second problem they proposed
devising a dynamic FP-tree reordering algorithm, and employing this algorithm whenever a
“promotion” to a higher order of at least one item is detected.
An important feature in this approach is that it’s not necessary to rebuild the FP-Tree when the
actual database is updated. It’s only needed to execute the algorithm again taking into
consideration the new transactions and the stored FP-Tree.
Another adaptation proposed, because of the dynamic reordering process, is a modification in the
original structures, by replacing the single linked list with a doubly linked list for linking the tree
nodes to the header and adding a master-table to the same header.
FP-Bonsai Algorithm
The FP-Bonsai improve the FP-Growth performance by reducing (pruning) the FP-Tree using
for more
the ExAnte data-reduction technique. The pruned FP-Tree was called FP-Bonsai. See [6]
details.
AFOPT Algorithm
.
Investigating the FP-Growth algorithm performance Liu proposed the AFOPT algorithm in [12]
This algorithm aims at improving the FP-Growth performance in four perspectives:
● Item Search Order: when the search space is divided, all items are sorted in some
order. The number of the conditional databases constructed can differ very much
using different items search orders;
● Conditional Database Representation: the traversal and construction cost of a
conditional database heavily depends on its representation;
● Conditional Database Construction Strategy: constructing every conditional
database physically can be expensive affecting the mining cost of each individual
conditional database;
● Tree Traversal Strategy: the traversal cost of a tree is minimal using top-down
traversal strategy.
NONORDFP Algorithm
The Nonordfp algorithm [15] [5] was motivated by the running time and the space required for the
FP-Growth algorithm. The theoretical difference is the main data structure (FP-Tree), which is
more compact and which is not needed to rebuild it for each conditional step. A compact,
memory efficient representation of an FP-tree by using Trie data structure, with memory layout
that allows faster traversal, faster allocation, and optionally projection was introduced.
FP-Growth* Algorithm
This algorithm was proposed by Grahne et al, and is based in his conclusion about the usage of
CPU time to compute frequent item sets using FP-Growth. They observed that 80% of CPU time
was used for traversing FP-Trees. Therefore, they used an array-based data structure combined
with the FP-Tree data structure to reduce the traversal time, and incorporates several
optimization techniques.
These three algorithms were proposed by Deng et al, and are based on three novel data structures
called Node-list, N-list, and Nodeset respectively for facilitating the mining process of frequent
itemsets. They are based on a FP-tree with each node encoding with pre-order traversal and
post-order traversal. Compared with Node-lists, N-lists and Nodesets are more efficient. This
causes the efficiency of PrePost and FIN] is higher than that of PPV.
CONCLUSION
In this term paper an efficient and scalable algorithm to mine frequent patterns in databases was
presented: the FP-Growth. This algorithm uses a useful data structure, the FP-Tree, to store
information about frequent patterns. It is used with databases and not with streams. The Apriori
algorithm needs n+1 scans if a database is used, where n is the length of the longest pattern. By
using the FP-Growth method, the number of scans of the entire database can be reduced to two.It
can be assumed that the FP-Growth algorithm is more efficient.
REFERENCES