getTree {ofw}R Documentation

Extract a single tree from the last iteration of ofwCART.

Description

This function extract the structure of a tree from a ofwCART object for the last iteration.

Usage

getTree(ofwobj, k=1)

Arguments

ofwobj a ofw object applied with classifier CART.
k which tree to extract form the last forest?

Details

This function comes from the randomForest package.

Value

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

See Also

ofw

Examples

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)

[Package ofw version 1.0-0 Index]