Apriori discovers useful relationships among items in transactional data, supporting market-basket analysis for product placement, marketing, and pricing decisions. section 4.11
It searches bottom-up: generate frequent itemset candidates at one level, calculate their support, then expand surviving combinations until all items are exhausted. Rules separate antecedents from consequents, such as {bread} -> {milk}. section 4.4
A practical Python workflow includes:
- Load the transaction CSV with pandas, inspect .info() and .head(), and correct accidental header handling with header=None. section 4.4.1
- Convert the dataframe into a list of lists because the Apriori implementation expects one inner list per transaction. section 4.4.1
- Run apyori with minimum support, confidence, lift, and rule-length thresholds; convert the result to a list for inspection. section 4.4.1
- Print item pairs alongside support, confidence, and lift to interpret the generated rules. section 4.4.1
Bread, milk, eggs, and cheese
Starting with bread at level 1, Apriori evaluates {bread, milk}, {bread, eggs}, and {bread, cheese}, then larger combinations such as {bread, eggs, milk} -> {cheese}. section 4.4
Threshold tuning
On the store dataset, minimum support values of 50%, 25%, and 10% with minimum lift 4 produce no rules; lowering minimum lift to 2 produces 200 rules. section 4.4.1
Apriori can become slow and memory-intensive because it generates many candidate subsets and scans the database repeatedly. Minimum support limits candidate growth, while ECLAT and FP-growth offer alternative frequent-itemset strategies. section 4.4.2

