我使用arulesSequence包和ruleInduction函数生成序列规则,结果包含递归规则,如:
{A} => {A}
{A, B} => {A, B}
如何摆脱这些规则?
答案 0 :(得分:0)
之后确定您的规则:
library(arulesSequences)
example(cspade)
rules <- ruleInduction(s5, confidence = 0.0)
df <- data.frame(lhs = labels(lhs(rules)), rhs = labels(rhs(rules)), rules@quality, stringsAsFactors = FALSE)
subset(df, lhs==rhs)
# lhs rhs support confidence lift
# 22 <{F}> <{F}> 0.25 0.2500000 0.2500000
# 1628 <{A,F}> <{A,F}> 0.25 0.3333333 0.4444444
# 2564 <{C}> <{C}> 0.25 1.0000000 4.0000000
# 2981 <{B}> <{B}> 0.25 0.2500000 0.2500000
# 3015 <{A,B}> <{A,B}> 0.25 0.3333333 0.4444444
# 3040 <{A}> <{A}> 0.25 0.2500000 0.2500000
subset(df, lhs!=rhs)
# ...