prune.bagging: Pruning for Bagging

Description Usage Arguments Details Value Examples

Description

Prune each of the trees returned by bagging.

Usage

1
2
## S3 method for class 'classbagg'
prune(tree, cp=0.01,...)

Arguments

tree

an object returned by bagging (calling this tree is needed by the generic function prune in package rpart).

cp

complexity parameter, see prune.rpart.

...

additional arguments to prune.rpart.

Details

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.

Value

An object of the same class as tree with the trees pruned.

Examples

1
2
3
4
5
6
data("Glass", package = "mlbench")
library("rpart")

mod <- bagging(Type ~ ., data=Glass, nbagg=10, coob=TRUE)
pmod <- prune(mod)
print(pmod)


Search within the ipred package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.