在 aRules R 中的包,我怎样才能有效地找到封闭关联规则?即具有封闭 LHS 项集的规则
如果添加任何项都会减少支持,则项集被关闭。
该软件包提供以下挖掘选项:
target: a character string indicating the type of association mined. One of
- "frequent itemsets"
- "maximally frequent itemsets"
- "closed frequent itemsets"
- "rules" (only available for Apriori)
- "hyperedgesets" (only available for Apriori; see references for the definition of association • hyperedgesets)
似乎没有“封闭规则”选项。有两个明显的解决方法:
挖掘规则并对封闭项集应用过滤器
rules = apriori(data, parameter=list(target="rules"))) rules <- rules[is.closed(generatingItemsets(rules))]
这可能会很慢。例如,对于 10k 个项目的 5k 笔交易,aPriori 在 10 秒内生成了 8M 条规则。闭合过滤器花费了约 20 分钟,导致约 3k 条闭合规则。
- 挖掘封闭的频繁项集并应用关联过滤器(置信度、提升度等)
尚未实现,但这似乎是实现更简单的事情的一种迂回方式。
如果有人知道可以做到这一点的其他实现(其他 R 包甚至 R 之外的东西),指针将非常有帮助。 例如。 The SPMF library似乎支持它,想知道是否有人有使用它的经验
最佳答案
函数ruleInduction()
可用于创建由以下定义的封闭规则
裴等人。 (2000) 作为规则 X -> Y
,其中 X
和 Y
是闭频繁项集。以下内容摘自手册页(略有增强):
data("Adult")
## find all closed frequent itemsets
closed <- apriori(Adult,
parameter = list(target = "closed", support = 0.4))
## use rule induction to produce all closed association rules
closed_rules <- ruleInduction(closed, Adult)
## X&Y are already closed, check that X is also closed
closed_rules[is.element(lhs(closed_rules), items(closed))]
## inspect the resulting closed rules
summary(closed_rules)
inspect(head(closed_rules, by = "lift"))
关于R 规则 : Find closed association rules,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38967723/