# Apriori gives 0 rules

I am trying to use apriori() on this dataset. After cleaning it, I made all attributes categorical with as.factor(). Then I uset these instruction:

chocolate_rules <- apriori(chocolateApriori, parameter=list(minlen=3, supp=0.1, conf=0.7), appearance=list(default="lhs", rhs=c("RatFactor=1", "RatFactor=2", "RatFactor=3", "RatFactor=4", "RatFactor=5")))


where RatFactor is categorial rounded "Rating" from the original dataset (and has only 5 possible values).

It seems to work, but when I call "chocolate-rules" the result is set of 0 rules. Can you explain me why? Or can you help me getting another result?

• Okay.. so why are you using "apriori" on this dataset? what is the problem statement? May 23 '20 at 17:24
• I am trying as an exercise. I thought I could find rules between chocolate rating and all the other attributes May 23 '20 at 17:29

"Apriori" algorithm is used for "Association Rules" learning.

In very simple terms its trying to determine that if people who buy chocolates ,do they buy roses also with that? or do they buy chocolate with ice-cream more? or its chocolate+roses+ice-cream always together? or any combination of it.

So, the data which contains these purchase transactions are analysed and then "frequent item sets" are determined.

From this "rules" are derived , eg. here a rule can be, chocolates are bought with roses, or roses are bought with chocolates.

Each rule has confidence and support.

Now in you dataset, do you don't seem to have transactions, rather it has attributes regarding chocolates and its rating.which doesn't suit associative learning since the objective is different.

For the "learning" purpose, if its predicting that there are NO rules, means there are NO rules to determine.

Here something to get you started-

https://en.wikipedia.org/wiki/Apriori_algorithm

https://en.wikipedia.org/wiki/Association_rule_learning

• Thank you very much for your kind and clear answer! May 23 '20 at 17:45