Decision Tree Model
## Call:
## rpart(formula = Decision_Criterion ~ Conversion + Price_Comp +
## OA_Bounce_rate + OA_Cart_Views + OA_Visit_Freq, data = Staples_Aggr_Monthly_Dec_Train)
## n= 839
##
## CP nsplit rel error xerror xstd
## 1 0.27923628 0 1.0000000 1.0883055 0.03443395
## 2 0.08114558 1 0.7207637 0.7279236 0.03325260
## 3 0.03579952 2 0.6396181 0.6754177 0.03268403
## 4 0.03102625 4 0.5680191 0.6682578 0.03259792
## 5 0.01431981 5 0.5369928 0.5847255 0.03143267
## 6 0.01193317 6 0.5226730 0.5799523 0.03135677
## 7 0.01000000 7 0.5107399 0.5823389 0.03139485
##
## Variable importance
## Conversion OA_Cart_Views Price_Comp OA_Visit_Freq OA_Bounce_rate
## 32 29 26 7 6
##
## Node number 1: 839 observations, complexity param=0.2792363
## predicted class=1 expected loss=0.4994041 P(node) =1
## class counts: 420 419
## probabilities: 0.501 0.499
## left son=2 (392 obs) right son=3 (447 obs)
## Primary splits:
## Price_Comp < 1.255 to the right, improve=33.071690, (0 missing)
## Conversion < 0.105 to the left, improve=15.906430, (0 missing)
## OA_Visit_Freq < 41.045 to the left, improve= 9.623099, (0 missing)
## OA_Cart_Views < 634 to the left, improve= 9.560619, (0 missing)
## OA_Bounce_rate < 31.71 to the left, improve= 5.072384, (0 missing)
## Surrogate splits:
## OA_Cart_Views < 654 to the left, agree=0.633, adj=0.214, (0 split)
## OA_Visit_Freq < 44.485 to the left, agree=0.578, adj=0.097, (0 split)
## OA_Bounce_rate < 8.93 to the left, agree=0.571, adj=0.082, (0 split)
## Conversion < 0.245 to the left, agree=0.559, adj=0.056, (0 split)
##
## Node number 2: 392 observations, complexity param=0.03579952
## predicted class=1 expected loss=0.3494898 P(node) =0.4672229
## class counts: 255 137
## probabilities: 0.651 0.349
## left son=4 (66 obs) right son=5 (326 obs)
## Primary splits:
## Conversion < 0.495 to the right, improve=13.246120, (0 missing)
## OA_Cart_Views < 448.5 to the right, improve= 9.523887, (0 missing)
## OA_Bounce_rate < 21.775 to the right, improve= 7.127056, (0 missing)
## OA_Visit_Freq < 48.8 to the right, improve= 3.884111, (0 missing)
## Price_Comp < 2.04 to the right, improve= 3.780656, (0 missing)
##
## Node number 3: 447 observations, complexity param=0.08114558
## predicted class=2 expected loss=0.3691275 P(node) =0.5327771
## class counts: 165 282
## probabilities: 0.369 0.631
## left son=6 (112 obs) right son=7 (335 obs)
## Primary splits:
## OA_Cart_Views < 484.5 to the left, improve=23.879980, (0 missing)
## Conversion < 0.195 to the left, improve=21.550910, (0 missing)
## Price_Comp < 1.235 to the left, improve= 6.181561, (0 missing)
## OA_Visit_Freq < 38.835 to the left, improve= 5.716487, (0 missing)
## OA_Bounce_rate < 25.885 to the left, improve= 5.178898, (0 missing)
## Surrogate splits:
## OA_Visit_Freq < 22.495 to the left, agree=0.781, adj=0.125, (0 split)
## Conversion < 0.055 to the left, agree=0.770, adj=0.080, (0 split)
## OA_Bounce_rate < 4.015 to the left, agree=0.767, adj=0.071, (0 split)
##
## Node number 4: 66 observations
## predicted class=1 expected loss=0.06060606 P(node) =0.07866508
## class counts: 62 4
## probabilities: 0.939 0.061
##
## Node number 5: 326 observations, complexity param=0.03579952
## predicted class=1 expected loss=0.4079755 P(node) =0.3885578
## class counts: 193 133
## probabilities: 0.592 0.408
## left son=10 (232 obs) right son=11 (94 obs)
## Primary splits:
## Conversion < 0.405 to the left, improve=16.722660, (0 missing)
## OA_Bounce_rate < 21.775 to the right, improve= 7.736022, (0 missing)
## OA_Visit_Freq < 29.245 to the left, improve= 5.475470, (0 missing)
## Price_Comp < 2.04 to the right, improve= 5.460881, (0 missing)
## OA_Cart_Views < 448.5 to the right, improve= 5.321901, (0 missing)
## Surrogate splits:
## OA_Cart_Views < 2567 to the left, agree=0.73, adj=0.064, (0 split)
##
## Node number 6: 112 observations
## predicted class=1 expected loss=0.3482143 P(node) =0.1334923
## class counts: 73 39
## probabilities: 0.652 0.348
##
## Node number 7: 335 observations, complexity param=0.03102625
## predicted class=2 expected loss=0.2746269 P(node) =0.3992849
## class counts: 92 243
## probabilities: 0.275 0.725
## left son=14 (17 obs) right son=15 (318 obs)
## Primary splits:
## Conversion < 0.125 to the left, improve=13.228550, (0 missing)
## Price_Comp < 1.235 to the left, improve= 3.315458, (0 missing)
## OA_Visit_Freq < 41.605 to the left, improve= 2.958386, (0 missing)
## OA_Bounce_rate < 30.235 to the left, improve= 2.203859, (0 missing)
## OA_Cart_Views < 1026.5 to the right, improve= 1.119665, (0 missing)
##
## Node number 10: 232 observations
## predicted class=1 expected loss=0.3060345 P(node) =0.2765197
## class counts: 161 71
## probabilities: 0.694 0.306
##
## Node number 11: 94 observations, complexity param=0.01431981
## predicted class=2 expected loss=0.3404255 P(node) =0.1120381
## class counts: 32 62
## probabilities: 0.340 0.660
## left son=22 (50 obs) right son=23 (44 obs)
## Primary splits:
## OA_Cart_Views < 753.5 to the right, improve=10.300040, (0 missing)
## OA_Visit_Freq < 48.87 to the right, improve= 4.598480, (0 missing)
## Price_Comp < 1.63 to the left, improve= 3.496717, (0 missing)
## OA_Bounce_rate < 18.175 to the right, improve= 3.423577, (0 missing)
## Conversion < 0.455 to the right, improve= 2.026942, (0 missing)
## Surrogate splits:
## OA_Bounce_rate < 6.915 to the right, agree=0.734, adj=0.432, (0 split)
## OA_Visit_Freq < 45.66 to the right, agree=0.691, adj=0.341, (0 split)
## Price_Comp < 1.475 to the left, agree=0.649, adj=0.250, (0 split)
## Conversion < 0.455 to the right, agree=0.574, adj=0.091, (0 split)
##
## Node number 14: 17 observations
## predicted class=1 expected loss=0.1176471 P(node) =0.02026222
## class counts: 15 2
## probabilities: 0.882 0.118
##
## Node number 15: 318 observations
## predicted class=2 expected loss=0.2421384 P(node) =0.3790226
## class counts: 77 241
## probabilities: 0.242 0.758
##
## Node number 22: 50 observations, complexity param=0.01193317
## predicted class=1 expected loss=0.44 P(node) =0.05959476
## class counts: 28 22
## probabilities: 0.560 0.440
## left son=44 (27 obs) right son=45 (23 obs)
## Primary splits:
## Price_Comp < 1.335 to the right, improve=2.4242190, (0 missing)
## OA_Cart_Views < 1022.5 to the left, improve=1.6988240, (0 missing)
## OA_Visit_Freq < 46.695 to the right, improve=1.5675360, (0 missing)
## OA_Bounce_rate < 7.1 to the left, improve=0.7891841, (0 missing)
## Conversion < 0.415 to the right, improve=0.2811960, (0 missing)
## Surrogate splits:
## OA_Cart_Views < 1211.5 to the left, agree=0.66, adj=0.261, (0 split)
## OA_Bounce_rate < 26.395 to the left, agree=0.62, adj=0.174, (0 split)
## OA_Visit_Freq < 50.485 to the left, agree=0.62, adj=0.174, (0 split)
## Conversion < 0.415 to the right, agree=0.56, adj=0.043, (0 split)
##
## Node number 23: 44 observations
## predicted class=2 expected loss=0.09090909 P(node) =0.05244338
## class counts: 4 40
## probabilities: 0.091 0.909
##
## Node number 44: 27 observations
## predicted class=1 expected loss=0.2962963 P(node) =0.03218117
## class counts: 19 8
## probabilities: 0.704 0.296
##
## Node number 45: 23 observations
## predicted class=2 expected loss=0.3913043 P(node) =0.02741359
## class counts: 9 14
## probabilities: 0.391 0.609
Decision Tree
Model Validation
## Predict
## Actual 1 2
## 1 138 50
## 2 56 114
## Actual Predict value Decision
## 1: 2 2 114 True Positive
## 2: 2 1 56 True Negative
## 3: 1 2 50 False Positive
## 4: 1 1 138 False Negative
## 1 2 Per_Correct
## 1 138 50 38.54749
## 2 56 114 31.84358
## [1] 70.39106
Classification Accuracy