getTree {ofw} | R Documentation |
This function extract the structure of a tree from a
ofwCART
object for the last iteration.
getTree(ofwobj, k=1)
ofwobj |
a ofw object applied with classifier CART. |
k |
which tree to extract form the last forest? |
This function comes from the randomForest
package.
A matrix (or data frame, if labelVar=TRUE
) with six columns and
number of rows equal to total number of nodes in the tree. The six
columns are:
left daughter |
the row where the left daughter node is; 0 if the node is terminal |
right daughter |
the row where the right daughter node is; 0 if the node is terminal |
split var |
which variable was used to split the node; 0 if the node is terminal |
split point |
where the best split is; see Details for categorical predictor |
status |
is the node terminal (-1) or not (1) |
prediction |
the prediction for the node; 0 if the node is not terminal |
data(srbct) attach(srbct) ##ofwCART learn.cart.keep <- ofw(srbct, as.factor(class),type="CART", ntree=50, nforest=10, mtry=5, keep.forest=TRUE) getTree(learn.cart.keep, k=3) detach(srbct)