rt.prune: Prune a tree-based model using the SE rule

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/trees.R

Description

This function implements the SE post pruning rule described in the CART book (Breiman et. al., 1984)

Usage

1
rt.prune(tree, se = 1, verbose = T, ...)

Arguments

tree

An rpart object

se

The value of the SE threshold (defaulting to 1)

verbose

The level of verbosity (defaulting to T)

...

Any other arguments passed to the function prune.rpart()

Details

The x-SE rule for tree post-pruning is based on the cross-validation estimates of the error of the sub-trees of the initially grown tree, together with the standard errors of these estimates. These values are used to select the final tree model. Namely, the selected tree is the smallest tree with estimated error less than the B+x*SE, where B is the lowest estimate of error and SE is the standard error of this B estimate.

Value

A rpart object

Author(s)

Luis Torgo ltorgo@dcc.fc.up.pt

References

Breiman, L., Friedman, J., Olshen, R., and Stone, C. (1984). Classification and regression trees. Statistics/Probability Series. Wadsworth & Brooks/Cole Advanced Books & Software.

Torgo, L. (2010) Data Mining using R: learning with case studies, CRC Press (ISBN: 9781439810187).

http://www.dcc.fc.up.pt/~ltorgo/DataMiningWithR

See Also

rt.prune, rpart, prune.rpart

Examples

1
2
3
4
5
6
7
8
9
data(iris)
tree <- rpartXse(Species ~ ., iris)
tree

## A visual representation of the classification tree
## Not run: 
prettyTree(tree)

## End(Not run)

Example output

Loading required package: lattice
Loading required package: grid
n= 150 

node), split, n, loss, yval, (yprob)
      * denotes terminal node

 1) root 150 100 setosa (0.33333333 0.33333333 0.33333333)  
   2) Petal.Length< 2.45 50   0 setosa (1.00000000 0.00000000 0.00000000) *
   3) Petal.Length>=2.45 100  50 versicolor (0.00000000 0.50000000 0.50000000)  
     6) Petal.Width< 1.75 54   5 versicolor (0.00000000 0.90740741 0.09259259)  
      12) Petal.Length< 4.95 48   1 versicolor (0.00000000 0.97916667 0.02083333) *
      13) Petal.Length>=4.95 6   2 virginica (0.00000000 0.33333333 0.66666667) *
     7) Petal.Width>=1.75 46   1 virginica (0.00000000 0.02173913 0.97826087) *

DMwR documentation built on May 1, 2019, 9:17 p.m.