bagging method
bagging(form, data, ntrees, pruning, dselection, pruning_cp)
form
: formula
data
: training data
ntrees
: ntrees
pruning
: model pruning method. A character vector. Currently, the following methods are supported:
dselection
: dynamic selection of the available models. Currently, the following methods are supported:
pruning_cp
: The pruning cutpoint for the pruning
method picked.
# splitting an example dataset into train/test: train <- iris[1:(.7*nrow(iris)), ] test <- iris[-c(1:(.7*nrow(iris))), ] form <- Species ~. # a user-defined bagging workflow m <- bagging(form, iris, ntrees = 5, pruning = "bb", pruning_cp = .5, dselection = "ola") preds <- predict(m, test) # a standard bagging workflow with 5 trees (5 trees for examplification purposes): m2 <- bagging(form, iris, ntrees = 5, pruning = "none", dselection = "none") preds2 <- predict(m2, test)
baggedtrees
for the implementation of the bagging model.
Useful links