Answers:
先前的两个答案都是错误的。软件包GBM使用interaction.depth
参数作为它必须在树上执行的多个拆分(从单个节点开始)。由于每个分割为2(节点3和终端节点的数目增加的节点的总数 {左节点,右节点,NA节点})树中的节点的总数将是3 * Ñ + 1和数量终端节点2 * N +1的个数。可以通过查看函数的输出来验证这一点。pretty.gbm.tree
这种行为相当容易引起误解,因为用户确实希望深度是生成树的深度。它不是。
我对R中gbm中的交互深度参数有一个疑问。这可能是一个菜鸟问题,对此我深表歉意,但是我认为该参数表示树中终端节点的数量基本上是X方向的,预测变量之间的相互作用?
一看interaction.depth
作为分裂节点的数量。一个interaction.depth
固定在k将导致具有k + 1个节点 的终端节点 (omitting the NA nodes), so we have :
The link between interaction.depth
and interaction order is more tedious.
Instead of reasoning with the interaction.depth, let's reason with the number of terminal nodes, which we will called J.
Example: Let's say you have J=4 terminal nodes (interaction.depth=3) you can either :
So you cannot know in advance what will be the interaction order between your features in a given tree. However it is possible to upper bound this value. Let P be the interaction order of the features in a given tree. We have :
Actually, the previous answers are incorrect.
Let K be the interaction.depth, then the number of nodes N and leaves L (i.e terminal nodes) are respectively given by the following:
Each of these levels has nodes. And the tree's total number of nodes is the sum of the number of nodes at each level.
In mathematical terms:
which is equivalent to:
You can try
table(predict(gbm( y ~.,data=TrainingData, distribution="gaussian", verbose =FALSE, n.trees =1 , shrinkage =0.01, bag.fraction =1 , interaction.depth = 1 ),n.trees=1))
and see that there are only 2 unique predicted values. interaction.depth = 2 will get you 3 distinct predicted values. And convince yourself.