pythonpython-3.xdata-miningfpgrowth

Why does FP-Growth return more than one Consequent?


I am using fpgrowth module from Orange3-Associate to find the rules from transactions in a file. I am using this script:

from orangecontrib.associate.fpgrowth import *

transactions = [[1, 2, 5],
                [2, 4],
                [2, 3],
                [1, 2, 4],
                [1, 3],
                [2, 3],
                [1, 3],
                [1, 2, 3, 5],
                [1, 2, 3]]

itemsets = dict(frequent_itemsets(transactions, .2))
rules = [(list(P), list(Q), supp, conf) for P, Q, supp, conf in association_rules(itemsets, .5)]

However, when I print(rules), Consequent Q shows as list of 2 or more items. Output:

[3, 5], [1, 2], 1, 1.0

Why is this occurring? Isn't the Consequent supposed to be only 1 item?


Solution

  • No, the consequent is not restricted to a single item.

    If all your transactions contain A, B, then the rule emptyset -> A, B is the desired output to indicate that "no matter what the transaction contains A and B".