r - Post-processing of rules from arules -
is there way how more 1 level of single variable gets used in single rule generated apriori
in arules package?
consider following example:
df <- read.table(header = true, text = ' v1 v2 v3 d x d x d y b d x b d x b d y e y e y e x b e y b e y b e x c d y ') library(arules) rules <- apriori(df, parameter = list(support= 0.001, confidence = 0.5, target = "rules"), appearance = list(rhs=c("v3=x"), default = 'lhs')) inspect(sort(rules, decreasing = true, = "confidence"))
output>
lhs rhs support confidence lift 1 {v1=a, v2=d} => {v3=x} 0.1538462 0.6666667 1.444444 2 {v1=b, v2=d} => {v3=x} 0.1538462 0.6666667 1.444444 3 {v2=d} => {v3=x} 0.3076923 0.5714286 1.238095 4 {v1=a} => {v3=x} 0.2307692 0.5000000 1.083333 5 {v1=b} => {v3=x} 0.2307692 0.5000000 1.083333
in example, helpful if rule {v1=a,b,v2=d}
. other tools (e.g. lisp-miner) can generate rules more 1 level of variable used.
arules follows standard association rule mining literature , not aggregate items in way. itemsets either contain item or not. stuck 2 rules unless manually add artificial item v1=aorb
.
Comments
Post a Comment