15
$\begingroup$

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?

$\endgroup$

2 Answers 2

28
$\begingroup$

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:

enter image description here

$\endgroup$
17
  • 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$
    – meh
    Commented May 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$ Commented 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$ Commented 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$ Commented 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$ Commented May 18, 2018 at 22:13
0
$\begingroup$

Well if the features are categorical this above regression answer doesn't really hold true. Then it is dependent on the number of categories how many splits you can do on one feature. If each feature only has two categories, then OP would be correct.

$\endgroup$
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.