我有一个数据列表,我想在其中找到关联。我已经使用以下命令找到了频繁项集:
frequent_itemsets = apriori(df, min_support=0.01, use_colnames=True) support itemsets
0 0.020438 [AUCKLAND]
1 0.015320 [Adelaide]
2 0.043066 [Auckland]
....我需要找到自信。我使用关联规则函数作为-
aa = association_rules(frequent_itemsets, metric="confidence", min_threshold=0.001)但是这样我就得到了一个只有列名的空白表。
发布于 2019-03-05 11:21:27
records = []
for i in range(0, 7501):
`records.append([str(store_data.values[i,j]) for j in range(0, 20)]) association_rules = apriori(records, min_support=0.0045, min_confidence=0.2, min_lift=3, min_length=2)`我认为你的代码应该是这样的,你不应该在关联规则的情况下传递frequent_itemsets来应用,因为它对你的数据单独起作用,而你应该使用附加的名称,就像我在我的例子中使用记录一样。我希望你能有所了解。
https://stackoverflow.com/questions/50794833
复制相似问题