Professional Documents
Culture Documents
4.4-Apriori-Algorithm - (CourseMega - Com)
4.4-Apriori-Algorithm - (CourseMega - Com)
Apriori Algorithm
1
Recap: Steps for Finding Frequent Itemsets
• In the following, lengthen the itemsets and check whether “support ≥ minsup.”
• Stop the process when you cannot create a list of frequent itemset.
2
Recap: Association Rule Selection
3
Frequent Itemsets
5
Computing Association Rule
6
antecedents consequents antecedent consequent support confidence lift
support support
0 (almonds) (burgers) 0.020397 0.087188 0.005199 0.254902 2.923577
1 (burgers) (almonds) 0.087188 0.020397 0.005199 0.059633 2.923577
2 (almonds) (chcolate) 0.020397 0.163845 0.005999 0.294118 1.795099
3 (chcolate) (almonds) 0.163845 0.020397 0.005999 0.036615 1.795099
4 (almonds) (eggs) 0.020397 0.179709 0.006532 0.320261 1.782108
… … … … … … … …
1935 (spaghetti, olive oil) (pancakes) 0.022930 0.095054 0.005066 0.220930 2.324260
1936 (pancakes, olive oil) (spaghetti) 0.010799 0.174110 0.005066 0.469136 2.694478
1937 (spaghetti) (pancakes, olive oil) 0.174110 0.010799 0.005066 0.029096 2.694478
1938 (pancakes) (spaghetti, olive oil) 0.095054 0.022930 0.005066 0.053296 2.324260
1939 (olive oil) (spaghetti, pancakes) 0.065858 0.025197 0.005066 0.076923 3.052910
7
filtered_rules = Rules[(Rules['antecedent support'] > 0.01) &
(Rules['support'] > 0.009) &
(Rules['confidence'] > 0.5) &
(Rules['lift'] > 1.00)]
filtered_rules