Since the decision tree algorithm split on an attribute at every step, the maximum depth of a decision tree is equal to the number of attributes of the data. Is this correct?
1 Answer
No, because the data can be split on the same attribute multiple times. And this characteristic of decision trees is important because it allows them to capture nonlinearities in individual attributes.
Edit: In support of the point above, here's the first regression tree I created. Note that volatile acidity and alcohol appear multiple times:
-
5$\begingroup$ @mkt if you feel like editing again you can add that typically a decision tree stops creating new branches when wither a pre-specified purity level is reached, a node has less than a specified number of elements, or a split of a node would lead to a new node with less than a specified number of elements. These reasons can easily lead to an attribute not being used at all. $\endgroup$– mehMay 18, 2018 at 13:47
-
1$\begingroup$ +1, but this plot does leave something to be desired. Which branch represents
yes
, eg? It might help to post the dataset & code, if that's doable. $\endgroup$ May 18, 2018 at 14:05 -
4$\begingroup$ What I mean is, suppose
alcohol = 10.50
(ie,alcohol < 10.53
), do you then proceed down the right or left branch of the tree? $\endgroup$ May 18, 2018 at 14:35 -
1$\begingroup$ Nice answer! Can you clarify what your outcome variable was for the decision tree you built and also if there were any other attributes that did not turn out to be important and don't feature in your plot? $\endgroup$ May 18, 2018 at 14:38
-
1$\begingroup$ @IsabellaGhement how is that relevant to the question that was asked? It seems like it would just distract from the main point. $\endgroup$ May 18, 2018 at 22:13