tommyod/Efficient-Apriori

Reducing H_1 update broken

selting opened this issue · 3 comments

Hello again,
thank you to @hprshayan for addressing #45 in #53.
However, the following example fails for me although all tests succeed:

from efficient_apriori.apriori import apriori
transactions = [(1, 2, 3), (1, 2, 3), (1, 2, 3), (1, 2), (2, 3)]
apriori(transactions, 0.4, 0.8)

This is due to H_1 being empty at the time of entering _ap_genrules. Thus, the check if len(itemset) <= (len(H_m[0]) + 1) will give an IndexError.

If you could confirm that the example also fails for you, I might get around to creating a PR.

I can confirm that it fails here too.

Would reverting #53 fix this?

We need a test for this case! A PR would be greatly appreciated!

Hi @selting,
Thank you for the note. I confirm the example also fails for me for the reason you mentioned. I have a solution for that. I can create a PR.

Closed by #58