Description Usage Arguments Details Value Author(s) References See Also Examples
Determines a nested sequence of subtrees of the supplied tree by recursively “snipping” off the least important splits.
1 2 3 4 5 6 7 | prune.oblique.tree(
tree,
k = NULL,
newdata,
prune.impurity = c("deviance", "misclass"),
penalty = c("complexity", "size"),
eps = 1e-3)
|
tree |
Fitted model object of class |
k |
Cost-complexity parameter defining either a specific subtree of |
newdata |
Data frame upon which the sequence of cost-complexity subtrees is evaluated. If missing, the data used to grow the tree is used. |
prune.impurity |
Character string denoting the measure of node heterogeneity used to guide cost-complexity pruning. The default is |
penalty |
Character string denoting the measure of tree complexity used to guide cost-complexity pruning. The default is |
eps |
A lower bound for the probabilities, used to compute deviances if events of predicted probability zero occur in |
Determines a nested sequence of subtrees of the supplied tree by recursively "snipping" off the least important splits, based upon the cost-complexity measure.
If k
is supplied, the optimal subtree for that value is returned.
The response as well as the predictors referred to in the right side of the formula in tree
must be present by name in newdata
. These data are dropped down each tree in the tree sequence and deviances or losses calculated by comparing the supplied response to the prediction. A plot
method exists for objects of this class. It displays the value of the deviance, the number of misclassifications or the total loss for each subtree in the tree sequence. An additional axis displays the values of the cost-complexity parameter at each subtree.
If k
is supplied and is a scalar, an object of class c("oblique.tree","tree")
is returned that minimizes the cost-complexity measure for that k
. If k
is a vector, an object of class tree.sequence
is returned. The object contains the following components:
size |
The complexity of each tree in the cost-complexity pruning sequence. |
deviance |
Total deviance of each tree in the cost-complexity pruning sequence. |
k |
The value of the cost-complexity pruning parameter of each tree in the sequence. |
A. Truong
Truong. A (2009) Fast Growing and Interpretable Oblique Trees via Probabilistic Models
Ripley, B. D. (1996). Pattern Recognition and Neural Networks. Cambridge University Press, Cambridge. Chapter 7.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #grow an mixture tree on the Pima Indian dataset
data(Pima.tr, package = "MASS")
ob.tree <- oblique.tree(formula = type~.,
data = Pima.tr,
oblique.splits = "on")
plot(ob.tree);text(ob.tree);title(main="Mixture Tree")
#examine the tree sequence
tree.seq <- prune.oblique.tree( tree = ob.tree)
print(tree.seq);plot(tree.seq)
#examine test error over the tree sequence
data(Pima.te, package = "MASS")
tree.seq <- prune.oblique.tree( tree = ob.tree,
newdata = Pima.te)
print(tree.seq);plot(tree.seq)
#deviance is least when k = 8.148267
pruned <- prune.oblique.tree( tree = ob.tree,
k = 9)
plot(pruned);text(pruned);title(main="Pruned Tree")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.