Tryzis
Tryzis

Reputation: 39

How to interpret Apyori (Apriori algorithm) output for association rules longer than 2?

I have implemented the Apriori algorithm to find frequent itemsets and association rules on my dataset and the Apyori library in Python gives me these results :

Motif   Support  Confidence      Lift
0          [05M09T, 05M093]  0.066946    0.524590  1.628273
1  [05M091, 05M092, 05M093]  0.052301    0.581395  1.804591

First line is understandable, but how to deal with the second one ? Is the association rule {05M091} --> {05M092, 05M093} or {05M091, 05M092} --> {05M093} ? Because it is not the same for the metrics computation!

Upvotes: 0

Views: 401

Answers (1)

Peter Larsen
Peter Larsen

Reputation: 21

So, you currently have 2 lists: list 0, is a K2 itemset, as it contains two items, which 7% (support) of people purchase together. There is 52%(confidence) chance that they will be purchased together and there it is 1.6(lift) times more likely than random chance that they will be purchased together.

list 1, is a k3 itemset and the same interpretation is made in the same way, just with three items. you currently have no association rules. Check your method.

An association rule has two lists on the same row. If we take an example from the Kaggle notebook referenced earlier

   antecedents          consequent          support   confidence   lift

65 (CHICKEN)    (COFFEE, BISCUIT, CORNFLAKES)     0.10     0.50     5.00

(please for give me for substituting in chicken) The association rule is (coffee, biscuit, cornflake) ==> chicken So 10% of people purchase chicken, coffee, biscuits and cornflakes at the same time. 50% of people who purchase coffee, biscuits and cornflakes also purchase chicken; it is 5x more likey than random chance that these purchases will occur together.

This is how I understand it.

Upvotes: 1

Related Questions