r - How could we know the ColumnName /attribute of items generated in Rules -


using arules package, 'apriori' returns 'rules' object.

how can make query - exact column item(s) in rules {lhs, rhs} come ?

example:

i've data in tabular manner in file "input.csv" , want associate/interpret returned rule itemsets column headers in file. how can possibly that?

any pointers appreciated. thanks,



a reproducible example:
input.csv

abc,def,ghi,jkl,mno 11,56789,1,0,10 12,57685,0,0,10 11,56789,0,1,11 10,57689,1,0,12 11,56789,0,1,12 10,57685,1,0,12 10,57689,1,0,10 11,56789,0,1,12 11,56789,0,0,10 11,56789,0,0,10 11,56789,0,1,10 11,56789,0,0,10 

call apriori :

transactions <- read.transactions("input.csv", format="basket", sep = ',', cols = null,  rm.duplicates = true) rules <- apriori(transactions, parameter = list(supp = 0.45, conf = 0.50, target = "rules")) 

returned result:

> inspect(rules)    lhs        rhs       support confidence     lift 1  {}      => {11}    0.6153846  0.6153846 1.000000 2  {}      => {56789} 0.6153846  0.6153846 1.000000 3  {}      => {1}     0.6153846  0.6153846 1.000000 4  {}      => {10}    0.6923077  0.6923077 1.000000 5  {}      => {0}     0.9230769  0.9230769 1.000000 6  {11}    => {56789} 0.6153846  1.0000000 1.625000 7  {56789} => {11}    0.6153846  1.0000000 1.625000 8  {11}    => {0}     0.6153846  1.0000000 1.083333 9  {0}     => {11}    0.6153846  0.6666667 1.083333 10 {56789} => {0}     0.6153846  1.0000000 1.083333 11 {0}     => {56789} 0.6153846  0.6666667 1.083333 12 {1}     => {0}     0.6153846  1.0000000 1.083333 13 {0}     => {1}     0.6153846  0.6666667 1.083333 14 {10}    => {0}     0.6923077  1.0000000 1.083333 15 {0}     => {10}    0.6923077  0.7500000 1.083333 16 {11, 56789} => {0}     0.6153846  1.0000000 1.083333 17 {0, 11}    => {56789} 0.6153846  1.0000000 1.625000 18 {0, 56789} => {11}    0.6153846  1.0000000 1.625000 

now, want make distinction between items of say, rule no.13

13 {0} => {1} 0.6153846 0.6666667 1.083333

{0} => {1} means, value of 0 in dimension "ghi" implies value of 1 in "jkl" or vice versa ?

so, there way can column name/id of values of itemsets returned in rules object ?

lhs = left hand side, rhs = right hand side

to read lhs => rhs.

{0} => {1} means: if transaction contains 0, has 1 somewhere.

however, you have not preprocessed data appropriately, results meaningless. data not basket input format me.


Comments