From the course: Machine Learning with Python: Association Rules
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
The Apriori algorithm - Python Tutorial
From the course: Machine Learning with Python: Association Rules
The Apriori algorithm
- Frequent itemset generation is a useful approach in limiting our focus to just those rules which are potentially actionable. While more efficient than the brute force approach, it is still computationally expansive. There are two common ways to reduce computational complexity during the process. One approach is to compress the data by storing the candidate itemsets in an advanced data structure, such as a frequent pattern tree or FP tree. That is what the FP growth algorithm does. The other approach is to reduce the number of candidate itemsets we create by leveraging the Apriori principle. This is what the Apriori algorithm does. The Apriori principle states that if an itemset is frequent, then all of its subsets must be frequent as well. To illustrate this concept, let's consider these itemset ladders which shows the 2-itemsets, 3-itemsets, 4-itemsets, and the 5-itemset that we can create from itemsets, A, B, C…