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?

  • $\begingroup$ Okay.. so why are you using "apriori" on this dataset? what is the problem statement? $\endgroup$ Commented May 23, 2020 at 17:24
  • $\begingroup$ I am trying as an exercise. I thought I could find rules between chocolate rating and all the other attributes $\endgroup$
    – user96624
    Commented May 23, 2020 at 17:29

1 Answer 1


"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-



  • $\begingroup$ Thank you very much for your kind and clear answer! $\endgroup$
    – user96624
    Commented May 23, 2020 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.