tommyod/Efficient-Apriori

lhs and rhs mixed up in the comments?

selting opened this issue · 1 comments

Hey

I was going through the code to understand the apriori algorithm, in particular, the rule generation in rules.py
In the _ap_genrules function, there are some comments and I was wondering whether the lhs and rhs got mixed up in the descriptions.
It says from Line 422:

    # Generate **left**-hand itemsets of length k + 1 if H is of length k
    H_m = list(apriori_gen(H_m))
    H_m_copy = H_m.copy()

    # For every possible **right** hand side
    for h_m in H_m:
        # Compute the **right** hand side of the rule
        lhs = tuple(sorted(set(itemset).difference(set(h_m))))

I have highlighted with ** the part of the comments that I believe might have gotten mixed up somehow.
Of course, the code works like a charm but I was wondering whether I had a misunderstanding of how it works.

You're right! Thanks for letting me know. Do you wan to create a PR?