为什么增长会带来不止一个结果?

2024-05-16 06:03:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用来自Orange3-Associatefpgrowth模块从文件中的事务中查找rules。我正在使用以下脚本:

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)]

但是,当I print(rules)时,随后的Q显示为2个或更多项的列表。输出:

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

为什么会发生这种情况?结果不应该只有一项吗?你知道吗


Tags: 模块from脚本conf事务associateruleslist