| prune.classbagg {ipred} | R Documentation |
Prune each of the trees returned by bagging.
## S3 method for class 'classbagg' prune(tree, cp=0.01,...)
tree |
an object returned by |
cp |
complexity parameter, see |
... |
additional arguments to |
By default, bagging grows classification
trees of maximal size. One may want to prune each tree, however,
it is not clear whether or not this may decrease prediction error.
An object of the same class as tree with the trees pruned.
data("Glass", package = "mlbench")
library("rpart")
mod <- bagging(Type ~ ., data=Glass, nbagg=10, coob=TRUE)
pmod <- prune(mod)
print(pmod)