R:在任何终端节点中具有最大观察数的库树

时间:2018-06-14 20:58:50

标签: r tree regression

我正在尝试在R中拟合回归树,但是想看看我是否可以施加附加条件,使得包括在终端节点(叶子)中的最大观察数量被用户设置为附加参数,例如: " maxcut&#34 ;.这意味着一旦构建了一个树,所有终端节点最多都有一个#max;" maxcut"观察次数。在库(树)中,我们可以设置mincut,它基本上是要包含在任一子节点中的最小观察数。我正在尝试添加相应的" maxcut"参数。

library(tree)
data(cpus, package="MASS")

# with the default mincut = 5
cpus.ltr <- tree(log10(perf) ~ syct+cach, cpus)
print(cpus.ltr)

# with the default mincut = 25
cpus.ltr.2 <- tree(log10(perf) ~ syct+cach, cpus,mincut=25)
print(cpus.ltr.2)



# I would like to see if we can have something like the following
cpus.ltr.3 <- tree(log10(perf) ~ syct+cach, cpus,maxcut=50)

我试着查看函数的源代码&#34; tree&#34;但是&#34; mincut&#34;只在函数中使用过一次,我无法弄清楚如何调整它。

有谁知道怎么做?

0 个答案:

没有答案
相关问题