我想使用包'partykit'来使用ctree()和cforest()构建分类树和森林。 由于我的数据集包含50000行和30列,我想将minsplit设置为150,将minbucket设置为50。 不幸的是,当我输入我的代码时
xplr=ctree_control(mincriterion = 0.999, minsplit=150, minbucket=50)
set.seed(123)
cit999=ctree(as.factor(order) ~ startHour, data=transact_train, controls=xplr)
我收到以下错误消息:
Error in ctree_control(...) :
unused argument (controls = list(teststat = "quad", testtype = "Bonferroni", mincriterion = -0.00100050033358353, minsplit = 150, minbucket = 50, minprob = 0.01, stump = FALSE, mtry = Inf, maxdepth = Inf, multiway = FALSE, splittry = 2, maxsurrogate = 0, majority = FALSE, applyfun = function (X, FUN, ...)
{
FUN <- match.fun(FUN)
if (!is.vector(X) || is.object(X)) X <- as.list(X)
.Internal(lapply(X, FUN))
}))
谁能告诉我为什么会这样?
答案 0 :(得分:5)
这是因为您指定了controls
而不是control
。
require(partykit)
data(HuntingSpiders) # example data from partykit
xplr=ctree_control(mincriterion = 0.999, minsplit=150, minbucket=50)
set.seed(123)
arct.lute <- as.factor(HuntingSpiders$arct.lute)
cit999=ctree(formula=arct.lute ~ ., data=HuntingSpiders, control=xplr)
cit999
Model formula:
arct.lute ~ pard.lugu + zora.spin + pard.nigr + pard.pull + aulo.albi +
troc.terr + alop.cune + pard.mont + alop.acce + alop.fabr +
arct.peri + water + sand + moss + reft + twigs + herbs
Fitted party:
[1] root: 0.35714285714 (n = 28, err = 14.428571429)
Number of inner nodes: 0
Number of terminal nodes: 1
>