I'm well familiar with the apriori algorithm, and the meaning of support/confidence/lift.
I'm currently using the apyori apriori implementation, and I'm not sure I understand the output of an apyori.apriori()
call.
It comes out like this
> RelationRecord(items=frozenset({'item1', 'item2'}),
> support=0.15365410803449842,
> ordered_statistics=[OrderedStatistic(items_base=frozenset({'item1'}),
> items_add=frozenset({'item2'}), confidence=0.6203420891875382,
> lift=2.2233410344037092),
> OrderedStatistic(items_base=frozenset({'item2'}),
> items_add=frozenset({'item1'}), confidence=0.5507049891540131,
> lift=2.2233410344037097)])
What is the rule? There are multiple support/confidence/lift, what each one denotes?
I'd appreciate a dictionary style explanation of each part of the output
The RelationRecord reflects a subset of items, while ordered_statistics is a list of OrderedStatistics, which reflect the rules. Each OrderedStatistics' items_base is the antecedent and the items_add is the consequent. The support is stored in the RelationRecord, since it's the same for the contained rules.
In your example:
item1 -> item2 with 0.62 confidence and 2.2233410344037092x lift
item2 -> item1 with 0.55 confidence and 2.2233410344037097x lift
Both have support=0.15365410803449842.
For what it's worth, I ended up switching to using PyFIM for relative feature richness and other bundled algorithms (e.g. fp-growth).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With