Conditional Inference trees in R (ctree)

r
kaggle
decision_trees

#1

Hello,

I looked up a tutorial on the problem ‘bike sharing demand’ which used the conditional inference trees algorithm from the ‘party’ package on the dataset. I am not able to interpret the result of the algorithm.
How to know which variables are important and which are not?
I get something like this(not putting up whole of the output here)->

Conditional inference tree with 207 terminal nodes

Response: count
Inputs: season, holiday, workingday, weather, temp, atemp, humidity, hour, daypart, sunday
Number of observations: 10886

  1. hour == {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21}; criterion = 1, statistic = 5623.75
  1. hour == {8, 16, 17, 18, 19}; criterion = 1, statistic = 1565.212
  2. temp <= 19.68; criterion = 1, statistic = 515.184
  3. workingday == {1}; criterion = 1, statistic = 185.765
  4. hour == {8, 17, 18}; criterion = 1, statistic = 160.553
  5. season == {2, 4}; criterion = 1, statistic = 119.435
  6. weather == {1, 2}; criterion = 1, statistic = 47.78
  7. daypart == {1}; criterion = 0.998, statistic = 16.273
    9)* weights = 82
  8. daypart == {3}
  9. season == {4}; criterion = 0.99, statistic = 10.759
    11)* weights = 90
  10. season == {2}
    12)* weights = 12
  11. weather == {3}
  12. humidity <= 88; criterion = 0.993, statistic = 11.584
    14)* weights = 12
  13. humidity > 88
    15)* weights = 8
  14. season == {1, 3}
  15. atemp <= 19.695; criterion = 1, statistic = 33.314
  16. daypart == {1}; criterion = 1, statistic = 21.872
    18)* weights = 67
  17. daypart == {3}
  18. temp <= 9.84; criterion = 1, statistic = 21.925
    20)* weights = 41
  19. temp > 9.84
  20. humidity <= 46; criterion = 0.951, statistic = 7.877
    22)* weights = 32
  21. humidity > 46
    23)* weights = 24
  22. atemp > 19.695
  23. weather == {1}; criterion = 0.961, statistic = 11.058
  24. humidity <= 54; criterion = 0.965, statistic = 8.515
    26)* weights = 21
  25. humidity > 54
    27)* weights = 12
  26. weather == {2, 3}
    28)* weights = 12
  27. hour == {16, 19}
  28. season == {2, 3, 4}; criterion = 1, statistic = 80.2
  29. weather == {1, 2}; criterion = 1, statistic = 26.74
    31)* weights = 104
  30. weather == {3}
    32)* weights = 10
  31. season == {1}
  32. temp <= 12.3; criterion = 1, statistic = 36.603
    34)* weights = 59
  33. temp > 12.3
  34. weather == {1, 2}; criterion = 0.99, statistic = 13.848
  35. atemp <= 20.455; criterion = 0.979, statistic = 9.421
    37)* weights = 45
  36. atemp > 20.455
    38)* weights = 19
  37. weather == {3}
    39)* weights = 7
  38. workingday == {0}
  39. hour == {16, 17, 18}; criterion = 1, statistic = 83.651
  40. season == {4}; criterion = 1, statistic = 57.151
  41. temp <= 12.3; criterion = 1, statistic = 22.09
    43)* weights = 11
  42. temp > 12.3
  43. temp <= 16.4; criterion = 0.982, statistic = 12.293
  44. hour == {16, 17}; criterion = 0.994, statistic = 14.739
    46)* weights = 33
  45. hour == {18}
    47)* weights = 17
  46. temp > 16.4
    48)* weights = 15
  47. season == {1, 2}
  48. atemp <= 17.425; criterion = 1, statistic = 20.911
    50)* weights = 61
  49. atemp > 17.425
    51)* weights = 43
  50. hour == {8, 19}
  51. season == {2, 4}; criterion = 1, statistic = 37.591
  52. holiday == {1}; criterion = 1, statistic = 27.722
    54)* weights = 7
  53. holiday == {0}
  54. hour == {19}; criterion = 1, statistic = 33.969
    56)* weights = 31
  55. hour == {8}
    57)* weights = 43
  56. season == {1, 3}
  57. temp <= 16.4; criterion = 0.988, statistic = 10.421
  58. hour == {19}; criterion = 0.992, statistic = 11.326
    60)* weights = 25
  59. hour == {8}
    61)* weights = 33
  60. temp > 16.4
    62)* weights = 12
  61. temp > 19.68
  62. hour == {17, 18}; criterion = 1, statistic = 218.821
  63. workingday == {1}; criterion = 1, statistic = 128.189
  64. weather == {1, 2}; criterion = 1, statistic = 40.98
    66)* weights = 341
  65. weather == {3}
  66. humidity <= 77; criterion = 0.964, statistic = 8.426
    68)* weights = 18
  67. humidity > 77
    69)* weights = 20
  68. workingday == {0}
  69. humidity <= 72; criterion = 1, statistic = 36.114
    71)* weights = 140
  70. humidity > 72
  71. humidity <= 79; criterion = 0.953, statistic = 7.955
    73)* weights = 18
  72. humidity > 79
    74)* weights = 9
  73. hour == {8, 16, 19}
  74. workingday == {1}; criterion = 1, statistic = 59.767
  75. hour == {8}; criterion = 1, statistic = 122.79
  76. weather == {1, 2}; criterion = 1, statistic = 28.147
    78)* weights = 129
  77. weather == {3}
    79)* weights = 11
  78. hour == {16, 19}
  79. hour == {19}; criterion = 1, statistic = 39.096
  80. weather == {1, 2}; criterion = 1, statistic = 32.597
  81. temp <= 27.06; criterion = 0.99, statistic = 11.689
  82. humidity <= 77; criterion = 0.983, statistic = 9.885
    84)* weights = 72
  83. humidity > 77
    85)* weights = 13
  84. temp > 27.06
    86)* weights = 82
  85. weather == {3}
    87)* weights = 13
  86. hour == {16}
  87. humidity <= 73; criterion = 1, statistic = 18.148
  88. season == {2, 3, 4}; criterion = 0.99, statistic = 16.231
    90)* weights = 166
  89. season == {1}
    91)* weights = 16
  90. humidity > 73
    92)* weights = 16
  91. workingday == {0}
  92. hour == {16, 19}; criterion = 1, statistic = 123.327
  93. humidity <= 54; criterion = 1, statistic = 43.586
  94. hour == {16}; criterion = 1, statistic = 21.514
    96)* weights = 61
  95. hour == {19}
  96. season == {3}; criterion = 0.964, statistic = 13.489
    98)* weights = 13
  97. season == {1, 2, 4}
  98. atemp <= 30.305; criterion = 0.979, statistic = 9.423
    100)* weights = 9
  99. atemp > 30.305
    101)* weights = 14
  100. humidity > 54
  101. humidity <= 73; criterion = 0.998, statistic = 14.037
    103)* weights = 41
  102. humidity > 73
  103. atemp <= 26.515; criterion = 0.96, statistic = 8.237
    105)* weights = 7
  104. atemp > 26.515
    106)* weights = 22
  105. hour == {8}
  106. sunday == {0}; criterion = 0.981, statistic = 9.624
    108)* weights = 33
  107. sunday == {1}
    109)* weights = 27
  108. hour == {7, 9, 10, 11, 12, 13, 14, 15, 20, 21}
  109. atemp <= 18.18; criterion = 1, statistic = 879.89
  110. season == {3, 4}; criterion = 1, statistic = 298.428
  111. temp <= 14.76; criterion = 1, statistic = 44.97
  112. daypart == {1, 2}; criterion = 1, statistic = 43.705
  113. atemp <= 15.15; criterion = 0.988, statistic = 12.076
  114. workingday == {1}; criterion = 0.999, statistic = 14.469
  115. daypart == {1}; criterion = 1, statistic = 59.582
  116. weather == {2}; criterion = 0.97, statistic = 11.568
    118)* weights = 12
  117. weather == {1, 3}
    119)* weights = 35
  118. daypart == {2}
    120)* weights = 50
  119. workingday == {0}
  120. daypart == {2}; criterion = 1, statistic = 51.128
    122)* weights = 28
  121. daypart == {1}
  122. hour == {9}; criterion = 1, statistic = 23.964
    124)* weights = 14
  123. hour == {7}
    125)* weights = 20
  124. atemp > 15.15
    126)* weights = 158
  125. daypart == {3}
  126. workingday == {1}; criterion = 1, statistic = 27.091
  127. weather == {1}; criterion = 0.999, statistic = 18.54
  128. hour == {20}; criterion = 0.998, statistic = 14.1
    130)* weights = 22
  129. hour == {21}
    131)* weights = 22
  130. weather == {2, 3}
    132)* weights = 18
  131. workingday == {0}
    133)* weights = 38
  132. temp > 14.76
    134)* weights = 10
  133. season == {1, 2}
  134. temp <= 9.84; criterion = 1, statistic = 64.16
  135. daypart == {1}; criterion = 1, statistic = 56.008
  136. workingday == {1}; criterion = 1, statistic = 56.483
  137. atemp <= 9.09; criterion = 0.978, statistic = 9.397
    139)* weights = 39
  138. atemp > 9.09
    140)* weights = 52
  139. workingday == {0}
  140. hour == {9}; criterion = 1, statistic = 21.192
    142)* weights = 20
  141. hour == {7}
    143)* weights = 24
  142. daypart == {2, 3}
  143. workingday == {0}; criterion = 1, statistic = 39.152
  144. daypart == {2}; criterion = 1, statistic = 22.123
    146)* weights = 57
  145. daypart == {3}
    147)* weights = 21
  146. workingday == {1}
  147. temp <= 9.02; criterion = 0.981, statistic = 17.808
  148. hour == {20}; criterion = 0.975, statistic = 22.057
    150)* weights = 21
  149. hour == {10, 11, 12, 13, 14, 15, 21}
    151)* weights = 130
  150. temp > 9.02
    152)* weights = 37
  151. temp > 9.84
  152. weather == {1, 2}; criterion = 1, statistic = 37.741
  153. daypart == {1}; criterion = 1, statistic = 38.516
  154. workingday == {1}; criterion = 1, statistic = 41.504
    156)* weights = 51
  155. workingday == {0}
  156. hour == {9}; criterion = 0.977, statistic = 9.308
    158)* weights = 12
  157. hour == {7}
    159)* weights = 14
  158. daypart == {2, 3}
  159. workingday == {0}; criterion = 1, statistic = 46.192
  160. daypart == {2}; criterion = 1, statistic = 48.461
    162)* weights = 87
  161. daypart == {3}
    163)* weights = 28
  162. workingday == {1}
  163. hour == {12, 20}; criterion = 0.972, statistic = 21.724
    165)* weights = 62
  164. hour == {10, 11, 13, 14, 15, 21}
    166)* weights = 168
  165. weather == {3}
    167)* weights = 36

Thanks.


#2

try plot this ctree and you will find it. for reference see


#3

Use varimp or varimpAUC function and pass you fitted object to it.
check this:

varimp(object, mincriterion = 0, conditional = FALSE,
threshold = 0.2, nperm = 1, OOB = TRUE, pre1.0_0 = conditional)
varimpAUC(object, mincriterion = 0, conditional = FALSE,
threshold = 0.2, nperm = 1, OOB = TRUE, pre1.0_0 = conditional)