rpart回归树解释

Roz*_*oze 1 r machine-learning decision-tree rpart

我在回归树上应用了 rpart.plot,但我不知道节点内的值指的是什么。以及如何选择根?非常感谢。您能解释一下每个节点内的值是什么吗?(图片显示了我的问题)

https://i.stack.imgur.com/tEofb.png

mis*_*use 5

根据rpart.plot 小插图

对于具有连续响应的模型(方差分析模型),每个节点显示:
- 预测值。
- 节点中观测值的百分比。

这是一个例子:

data(iris)
library(rpart)
library(rpart.plot)

rpart.plot(rpart(Sepal.Width ~., data = iris, cp = 0.1))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

根节点显示平均 Sepal.Width:

with(iris, round(mean(Sepal.Width), 1))
#output
[1] 3.1
Run Code Online (Sandbox Code Playgroud)

左节点代表杂色和维吉尼亚组合物种的平均萼片宽度。

with(iris, round(mean(Sepal.Width[Species != "setosa"]), 1))
#output
[1] 2.9
Run Code Online (Sandbox Code Playgroud)

右侧节点代表山毛榉物种的平均萼片宽度

with(iris, round(mean(Sepal.Width[Species == "setosa"]), 1))
#output
[1] 3.4
Run Code Online (Sandbox Code Playgroud)

对于具有二元响应的模型,每个节点显示
- 预测的类别。
- 预测概率
- 节点中观测值的百分比。