Abstract
The classic Apriori algorithm is a cornerstone of association rule mining but suffers from high computational costs during candidate generation and pruning. This paper proposes an improved version utilizing a "prefixed-itemset" data structure. By grouping itemsets with common prefixes in a hash map, the algorithm achieves significant speedups in the connecting and pruning phases. Experiments on a large-scale medical dataset demonstrate up to an 81% reduction in execution time compared to the standard Apriori method.
Introduction
In the field of data mining, association rule learning is a critical technique for discovering significant relationships between variables in large datasets. The Apriori algorithm serves as the foundational method for this task, employing an iterative, layer-by-layer approach to identify frequent itemsets.
However, Apriori faces a severe computational bottleneck during the candidate generation phase. To generate a $(k+1)$-itemset, the algorithm must compare all existing $k$-itemsets to identify those sharing a common prefix of length $k-1$. For $m$ itemsets, this connection step requires $O(k \times m^2)$ time. Additionally, the subsequent pruning step involves exhaustive scanning of all subsets, which becomes increasingly inefficient as dataset size and complexity grow.
Methodology
The proposed improvement addresses these inefficiencies by fundamentally restructuring how candidate itemsets are stored and processed.
Prefixed-Itemset-Based Storage
The core innovation lies in the use of a Map-like data structure (<key, value>) to store itemsets. For any $k$-itemset, the first $k-1$ items serve as the key (the prefix), while the final $k$-th item is stored as the value. Itemsets that share the same prefix are grouped together, with their distinct suffixes stored as a unioned set within the value field. This structure inherently compresses the data and organizes it for efficient retrieval.
Optimized Connecting and Pruning
By grouping itemsets by prefix, the connection step is reduced to $O(1)$ complexity. The algorithm no longer needs to perform a global search; it simply pairs items within the same suffix set for a given prefix key. Furthermore, the authors introduce a targeted pruning strategy. They prove mathematically that if a newly generated $(k+1)$-itemset contains an infrequent subset, that subset must include the two newly combined suffix items. This allows the algorithm to skip a vast majority of redundant subset checks, focusing only on those that could potentially invalidate the candidate.
Experimental Evaluation
The algorithm was evaluated using the Ruijin Hospital Diabetes Dataset, which contains 120,000 clinical records of prescription drug combinations.
Performance vs. Minimum Support
The efficiency of the improved algorithm was tested across varying minimum support thresholds. At low thresholds (e.g., min_sup = 600), where the number of candidate itemsets is high, the improved algorithm demonstrated a dramatic performance gain. It completed the task in approximately 25 seconds, compared to 210 seconds for the classical Apriori—an 81.44% speedup.
Scalability
When scaling the dataset from 10,000 to 100,000 records (at a fixed 2% minimum support), the improved algorithm consistently maintained a speedup between 66% and 76%. This demonstrates the robustness of the prefix-based approach for large-scale data mining tasks.
Discussion and Conclusion
While the improved algorithm offers significant advantages, it does exhibit overhead. At very high minimum support thresholds (e.g., min_sup = 5400), the number of frequent itemsets is so small that the overhead of managing the hash map structure slightly outweighs the savings in connection and pruning time. In these specific cases, the classical Apriori may perform marginally better.
In conclusion, the prefixed-itemset approach provides a powerful optimization for association rule mining. By leveraging efficient data structures and targeted pruning logic, it overcomes the primary bottlenecks of the classical Apriori algorithm, making it highly suitable for complex, real-world datasets like medical prescription records.
Summary updated