rpart_train
is a wrapper for rpart()
tree-based models
where all of the model arguments are in the main function.
rpart_train(
formula,
data,
weights = NULL,
cp = 0.01,
minsplit = 20,
maxdepth = 30,
...
)
A model formula.
A data frame.
Optional case weights.
A non-negative number for complexity parameter. Any split
that does not decrease the overall lack of fit by a factor of
cp
is not attempted. For instance, with anova splitting,
this means that the overall R-squared must increase by cp
at
each step. The main role of this parameter is to save computing
time by pruning off splits that are obviously not worthwhile.
Essentially, the user informs the program that any split which
does not improve the fit by cp
will likely be pruned off by
cross-validation, and that hence the program need not pursue it.
An integer for the minimum number of observations that must exist in a node in order for a split to be attempted.
An integer for the maximum depth of any node
of the final tree, with the root node counted as depth 0.
Values greater than 30 rpart
will give nonsense results on
32-bit machines. This function will truncate maxdepth
to 30 in
those cases.
Other arguments to pass to either rpart
or rpart.control
.
A fitted rpart model.