Association rule for A -> B, but not the other way around

I want to find the association for A (drinks, eg, coke, orange juice, milk…etc) to B (snacks, eg, chocolate bar, chips, …etc), that means when people buy drinks, what kind of snacks they will also buy, but not the other way around (NOT when people buy snacks, what kinds of drink they will also buy).

I have been using Association Rule (Borgelt) for this but feel not very effective as it will also find the association between all kinds of drinks and snacks. What nodes should be used or any setting in Borgelt that will limit the association of A -> B only but not all associations among As and Bs?

Hi,
I don’t think there is a node that can limit the itemsets before they are created, but you could filter them afterwards. Please have a look at the attached workflow for that. It first filters out all rules with an invalid consequent, then “flattens” the rules by ungrouping the antecedent and filters those as well. In the end it recreates the original collection cell for the antecedent and compares its size to the original one. If it has not changed, it is kept, otherwise the rule is discarded because some items were removed.
Kind regards,
Alexander

Assoc Rules.knwf (29.0 KB)

2 Likes

Thanks for your reply. I am now doing something similar (filter as much data as possible before and after association node) just want to see if possible to save some computation times, now it take a few hours.

You might want to take a look at this approach:
https://www.knime.com/self-tuning-association-rules-for-knime

I have integrated this in a collection of Rule Learners (still looking for a good example to demonstrate)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.