Search code examples
raprioriarulesmarket-basket-analysis

Is there any way i can get only 1 item in lhs of the association rule, in market basket analysis?


In aprioi algorithm i am getting the following results, however, i want just 1 item in lhs as in observation 108, is there any method to do so ?

[104]  {205,220}     => {1338}  0.001439682 0.277148253  5.856511   587
[105]  {272,1338}    => {220}   0.001172347 0.248569943  5.776527   478
[106]  {205,1215}    => {1366}  0.001035001 0.156180607  5.702459   422
[107]  {220,272}     => {1338}  0.001172347 0.264088398  5.580539   478
[108]  {351}         => {1366}  0.003676462 0.151720648  5.539617  1499

Solution

  • In the R package arules, you can limit the number of items in the rule to 2 when you call apriori().

    apriori(data, parameter = list(minlen = 2, maxlen = 2))