ctree_train | R Documentation |
These functions are slightly different APIs for partykit::ctree()
and
partykit::cforest()
that have several important arguments as top-level
arguments (as opposed to being specified in partykit::ctree_control()
).
ctree_train(
formula,
data,
weights = NULL,
minsplit = 20L,
maxdepth = Inf,
teststat = "quadratic",
testtype = "Bonferroni",
mincriterion = 0.95,
...
)
cforest_train(
formula,
data,
weights = NULL,
minsplit = 20L,
maxdepth = Inf,
teststat = "quadratic",
testtype = "Univariate",
mincriterion = 0,
mtry = ceiling(sqrt(ncol(data) - 1)),
ntree = 500L,
...
)
formula |
A symbolic description of the model to be fit. |
data |
A data frame containing the variables in the model. |
weights |
A vector of weights whose length is the same as |
minsplit |
The minimum sum of weights in a node in order to be considered for splitting. |
maxdepth |
maximum depth of the tree. The default |
teststat |
A character specifying the type of the test statistic to be applied. |
testtype |
A character specifying how to compute the distribution of the test statistic. |
mincriterion |
The value of the test statistic (for |
... |
Other options to pass to |
mtry |
Number of input variables randomly sampled as candidates at each
node for random forest like algorithms. The default |
ntree |
Number of trees to grow in a forest. |
An object of class party
(for ctree
) or cforest
.
if (rlang::is_installed(c("modeldata", "partykit"))) {
data(bivariate, package = "modeldata")
ctree_train(Class ~ ., data = bivariate_train)
ctree_train(Class ~ ., data = bivariate_train, maxdepth = 1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.