Differentiate between Apriori & FP-growth algorithm.
Differentiate between Apriori & FP-growth algorithm.
Best answer
| Criteria | Apriori Algorithm | FP-growth Algorithm |
|---|---|---|
| Purpose | Used for frequent itemset mining and association rule generation in data mining. | Also used for frequent itemset mining and association rule generation in data mining. |
| Algorithm Type | Apriori is an iterative candidate generation approach. | FP-growth is a divide-and-conquer approach. |
| Developed by | Rakesh Agrawal and Ramakrishnan Srikant in 1994. | Jiawei Han in 2000. |
| Key Idea | Uses candidate generation and pruning to find frequent itemsets. | Employs a frequent pattern tree structure to discover frequent itemsets without candidate generation. |
| Candidate Generation | Generates a large number of candidate itemsets. | Avoids explicit candidate generation. |
| Data Scanning | Scans the database multiple times, which can be computationally expensive for large datasets. | Scans the database twice: once to build a frequent pattern tree and then to mine frequent itemsets. |
| Efficiency | May be less efficient for large datasets with a high number of transactions and items. | Generally more efficient and scalable, especially for large and sparse datasets. |
| Memory Usage | Consumes more memory due to the need to store candidate itemsets. | Typically uses less memory due to the compact tree structure. |
| Pruning Strategies | Employs candidate pruning based on the Apriori principle. | Utilizes tree pruning and conditional pattern bases. |
| Implementation Complexity | More complex to implement due to candidate generation. | Simpler to implement due to the tree structure. |
| Parallel Processing | Challenging to parallelize effectively due to multiple iterations. | More amenable to parallel processing, especially when mining large datasets. |
| Example Applications | Market basket analysis, recommendation systems, and association rule mining. | Market basket analysis, intrusion detection, and any application requiring frequent pattern mining. |
Apriori finds frequent itemsets by generating and testing candidates level by level with many database scans; FP-growth compresses the data into an FP-tree in two scans and mines it without generating candidates.
| Point | Apriori | FP-growth |
|---|---|---|
| Proposed by | Agrawal and Srikant (1994) | Han, Pei and Yin (2000) |
| Technique | Breadth-first, generate-and-test (join and prune steps) | Divide and conquer on a compact FP-tree using conditional pattern bases |
| Candidate generation | Yes, can be huge | No candidate generation |
| Database scans | One scan per level (k scans for itemsets up to size k) | Only two scans (count items, then build the tree) |
| Main property used | Apriori property: every subset of a frequent itemset is frequent | Shared prefixes of transactions are stored once in the tree |
| Memory | Large candidate sets at each level | Tree is compact, but must fit in memory |
| Speed | Slow for large data or low support | Usually much faster |
| Implementation | Simple to understand and code | More complex (tree building and recursive mining) |
Example: with 100 frequent single items, Apriori must test \(\binom{100}{2}=4950\) candidate pairs in the second pass, while FP-growth never forms these candidates; it only follows the paths of the FP-tree.
Log in or create a free account to answer this question.