create table CustomerProductRevenue as select CustomerID, Description, sum(Quantity) as quantity from OnlineRetail where CustomerID > 0 group by CustomerID, Description order by quantity desc ; echo 'select CustomerID, Description from dataset04.CustomerProductRevenue where quantity > 10' | mysql -u pawan -p > CustomerProduct.txt # Edit the table delete the first line, replace space with underscore # Run a program to create association ready file, only pick the customers who buy more than one product java flatten < CustomerProduct.txt | grep " " > onlineAssociation.csv > rules = apriori(tr,parameter=list(support=0.001,confidence=0.3)) Apriori Parameter specification: confidence minval smax arem aval originalSupport maxtime support minlen 0.3 0.1 1 none FALSE TRUE 5 0.001 1 maxlen target ext 10 rules FALSE Algorithmic control: filter tree heap memopt load sort verbose 0.1 TRUE TRUE FALSE TRUE 2 TRUE Absolute minimum support count: 29 set item appearances ...[0 item(s)] done [0.00s]. set transactions ...[4233 item(s), 29856 transaction(s)] done [0.12s]. sorting and recoding items ... [947 item(s)] done [0.01s]. creating transaction tree ... done [0.03s]. checking subsets of size 1 2 3 4 5 6 done [0.02s]. writing ... [314 rule(s)] done [0.00s]. creating S4 object ... done [0.01s]. > rules = apriori(tr,parameter=list(support=0.01,confidence=0.3)) Apriori Parameter specification: confidence minval smax arem aval originalSupport maxtime support minlen 0.3 0.1 1 none FALSE TRUE 5 0.01 1 maxlen target ext 10 rules FALSE Algorithmic control: filter tree heap memopt load sort verbose 0.1 TRUE TRUE FALSE TRUE 2 TRUE Absolute minimum support count: 298 set item appearances ...[0 item(s)] done [0.00s]. set transactions ...[4233 item(s), 29856 transaction(s)] done [0.11s]. sorting and recoding items ... [7 item(s)] done [0.00s]. creating transaction tree ... done [0.00s]. checking subsets of size 1 2 done [0.00s]. writing ... [0 rule(s)] done [0.00s]. creating S4 object ... done [0.00s]. > rules = apriori(tr,parameter=list(support=0.002,confidence=0.3)) Apriori Parameter specification: confidence minval smax arem aval originalSupport maxtime support minlen 0.3 0.1 1 none FALSE TRUE 5 0.002 1 maxlen target ext 10 rules FALSE Algorithmic control: filter tree heap memopt load sort verbose 0.1 TRUE TRUE FALSE TRUE 2 TRUE Absolute minimum support count: 59 set item appearances ...[0 item(s)] done [0.00s]. set transactions ...[4233 item(s), 29856 transaction(s)] done [0.11s]. sorting and recoding items ... [463 item(s)] done [0.00s]. creating transaction tree ... done [0.02s]. checking subsets of size 1 2 3 done [0.01s]. writing ... [27 rule(s)] done [0.00s]. creating S4 object ... done [0.01s]. > inspect(rules) lhs rhs support confidence lift count [1] {PINK_POLKADOT_WRAP_} => {BLUE_POLKADOT_WRAP} 0.003282422 0.6049383 104.39906 98 [2] {BLUE_POLKADOT_WRAP} => {PINK_POLKADOT_WRAP_} 0.003282422 0.5664740 104.39906 98 [3] {PINK_POLKADOT_WRAP_} => {RED_RETROSPOT_WRAP_} 0.002344587 0.4320988 55.13137 70 [4] {BLUE_POLKADOT_WRAP} => {RED_RETROSPOT_WRAP_} 0.002713023 0.4682081 59.73855 81 [5] {RED_RETROSPOT_WRAP_} => {BLUE_POLKADOT_WRAP} 0.002713023 0.3461538 59.73855 81 [6] {WOODEN_TREE_CHRISTMAS_SCANDINAVIAN} => {WOODEN_STAR_CHRISTMAS_SCANDINAVIAN} 0.002579046 0.5877863 77.65021 77 [7] {WOODEN_STAR_CHRISTMAS_SCANDINAVIAN} => {WOODEN_TREE_CHRISTMAS_SCANDINAVIAN} 0.002579046 0.3407080 77.65021 77 [8] {PACK_OF_72_SKULL_CAKE_CASES} => {PACK_OF_72_RETROSPOT_CAKE_CASES} 0.002076635 0.3563218 24.06865 62 [9] {PACK_OF_60_DINOSAUR_CAKE_CASES} => {PACK_OF_72_RETROSPOT_CAKE_CASES} 0.002177117 0.3869048 26.13445 65 [10] {WOODEN_HEART_CHRISTMAS_SCANDINAVIAN} => {WOODEN_STAR_CHRISTMAS_SCANDINAVIAN} 0.003851822 0.5021834 66.34154 115 [11] {WOODEN_STAR_CHRISTMAS_SCANDINAVIAN} => {WOODEN_HEART_CHRISTMAS_SCANDINAVIAN} 0.003851822 0.5088496 66.34154 115 [12] {REGENCY_TEA_PLATE_PINK} => {REGENCY_TEA_PLATE_GREEN_} 0.002780011 0.8137255 184.04991 83 [13] {REGENCY_TEA_PLATE_GREEN_} => {REGENCY_TEA_PLATE_PINK} 0.002780011 0.6287879 184.04991 83 [14] {REGENCY_TEA_PLATE_PINK} => {REGENCY_TEA_PLATE_ROSES_} 0.002244105 0.6568627 126.52448 67 [15] {REGENCY_TEA_PLATE_ROSES_} => {REGENCY_TEA_PLATE_PINK} 0.002244105 0.4322581 126.52448 67 [16] {PACK_OF_60_PINK_PAISLEY_CAKE_CASES} => {PACK_OF_72_RETROSPOT_CAKE_CASES} 0.003315916 0.3852140 26.02025 99 [17] {60_TEATIME_FAIRY_CAKE_CASES} => {PACK_OF_72_RETROSPOT_CAKE_CASES} 0.002846999 0.3333333 22.51584 85 [18] {REGENCY_TEA_PLATE_GREEN_} => {REGENCY_TEA_PLATE_ROSES_} 0.002646034 0.5984848 115.27977 79 [19] {REGENCY_TEA_PLATE_ROSES_} => {REGENCY_TEA_PLATE_GREEN_} 0.002646034 0.5096774 115.27977 79 [20] {SINGLE_HEART_ZINC_T-LIGHT_HOLDER} => {HANGING_HEART_ZINC_T-LIGHT_HOLDER} 0.002277599 0.3863636 52.43306 68 [21] {HANGING_HEART_ZINC_T-LIGHT_HOLDER} => {SINGLE_HEART_ZINC_T-LIGHT_HOLDER} 0.002277599 0.3090909 52.43306 68 [22] {VINTAGE_HEADS_AND_TAILS_CARD_GAME_} => {VINTAGE_SNAP_CARDS} 0.002277599 0.3756906 42.16774 68 [23] {SET_OF_3_HEART_COOKIE_CUTTERS} => {SET_OF_3_BUTTERFLY_COOKIE_CUTTERS} 0.002143623 0.3878788 70.61286 64 [24] {SET_OF_3_BUTTERFLY_COOKIE_CUTTERS} => {SET_OF_3_HEART_COOKIE_CUTTERS} 0.002143623 0.3902439 70.61286 64 [25] {REGENCY_TEA_PLATE_GREEN_, pREGENCY_TEA_PLATE_PINK} => {REGENCY_TEA_PLATE_ROSES_} 0.002043140 0.7349398 141.56362 61 [26] {REGENCY_TEA_PLATE_PINK, pREGENCY_TEA_PLATE_ROSES_} => {REGENCY_TEA_PLATE_GREEN_} 0.002043140 0.9104478 205.92673 61 [27] {REGENCY_TEA_PLATE_GREEN_, pREGENCY_TEA_PLATE_ROSES_} => {REGENCY_TEA_PLATE_PINK} 0.002043140 0.7721519 226.01340 61