R:如何在'if-else'条件下读取ada的AdaBoost树规则?
R: How to read ada's AdaBoost tree rules in 'if-else' conditions?
有谁知道如何将 AdaBoost 树(R 中的结果)转换为 if-else 条件?
我在 R 中使用了 caret
包,以及 train
函数和 method="ada"
以获得对我的数据集的一些预测。
之后我使用rattle
包中的函数listTreesAda
来查看它们的结构(示例如下):
n= 45211
node), split, n, loss, yval, (yprob)
* denotes terminal node
1) root 45211 5280 no (0.88321426 0.11678574)
2) duration< 551.5 40743 3245 no (0.92035442 0.07964558)
4) poutcome=failure,other,unknown 39451 2431 no (0.93837926 0.06162074) *
5) poutcome=success 1292 478 yes (0.36996904 0.63003096)
10) duration=132.5 1066 300 yes (0.28142589 0.71857411) *
3) duration>=551.5 4468 2035 no (0.54453894 0.45546106)
6) duration=835.5 1688 697 yes (0.41291469 0.58708531) *
如何在 if-else 条件下读取它?
如果你想自己计算AdaBoost模型的最终功能,你会怎么做?
每棵树的权重 {w(1), w(2), ..., w(n)}
,你会将这个权重乘以什么?
对应于响应变量为 YES 的最终叶的规则? ... 响应变量为 NO 的地方? ... 树的每个 if-else 规则?
如你所见,我有点迷茫。
(此 post 与:
https://stats.stackexchange.com/questions/133088/use-adaboost-results-in-r-to-make-future-predictions-by-hand
和
)
经过一番努力,我明白了。至少阅读 if-else 条件...它是这样的:
____N=45211_____
|duration < 551.5|
|________________|
/\
_______(rule=TRUE, Y=no)_________/ \_______(rule=FALSE, Y=no)________
| |
______________|_________________ ______________|_____________
|poutcome=failure,other,unknown| | duration=835.5 |
|______________________________| |____________________________|
/\ /\
/ \ / \
____________/_ \__(rule=F,Y=yes)__ (rule=T, Y=yes) (rule=F, Y=...)
|(rule=T,Y=no)| | duration=132.5 | N=1688 N=(4468-1688)
|_____________| |_________________|
N=39451 /\
/ \
(rule=T, Y=yes) (rule=F, Y=... partial output)
N=1066 N=(1292-1066)=226
有谁知道如何将 AdaBoost 树(R 中的结果)转换为 if-else 条件?
我在 R 中使用了 caret
包,以及 train
函数和 method="ada"
以获得对我的数据集的一些预测。
之后我使用rattle
包中的函数listTreesAda
来查看它们的结构(示例如下):
n= 45211
node), split, n, loss, yval, (yprob)
* denotes terminal node
1) root 45211 5280 no (0.88321426 0.11678574)
2) duration< 551.5 40743 3245 no (0.92035442 0.07964558)
4) poutcome=failure,other,unknown 39451 2431 no (0.93837926 0.06162074) *
5) poutcome=success 1292 478 yes (0.36996904 0.63003096)
10) duration=132.5 1066 300 yes (0.28142589 0.71857411) *
3) duration>=551.5 4468 2035 no (0.54453894 0.45546106)
6) duration=835.5 1688 697 yes (0.41291469 0.58708531) *
如何在 if-else 条件下读取它?
如果你想自己计算AdaBoost模型的最终功能,你会怎么做?
每棵树的权重 {w(1), w(2), ..., w(n)}
,你会将这个权重乘以什么?
对应于响应变量为 YES 的最终叶的规则? ... 响应变量为 NO 的地方? ... 树的每个 if-else 规则?
如你所见,我有点迷茫。
(此 post 与: https://stats.stackexchange.com/questions/133088/use-adaboost-results-in-r-to-make-future-predictions-by-hand 和 )
经过一番努力,我明白了。至少阅读 if-else 条件...它是这样的:
____N=45211_____
|duration < 551.5|
|________________|
/\
_______(rule=TRUE, Y=no)_________/ \_______(rule=FALSE, Y=no)________
| |
______________|_________________ ______________|_____________
|poutcome=failure,other,unknown| | duration=835.5 |
|______________________________| |____________________________|
/\ /\
/ \ / \
____________/_ \__(rule=F,Y=yes)__ (rule=T, Y=yes) (rule=F, Y=...)
|(rule=T,Y=no)| | duration=132.5 | N=1688 N=(4468-1688)
|_____________| |_________________|
N=39451 /\
/ \
(rule=T, Y=yes) (rule=F, Y=... partial output)
N=1066 N=(1292-1066)=226