printRules {brif}R Documentation

Print the decision rules of a brif tree

Description

Print the decision rules of a brif tree

Usage

printRules(object, which_tree = 0)

Arguments

object

an object of class "brif" as returned by the brif training function.

which_tree

a nonnegative integer indicating the tree number (starting from 0) in the forest to be printed.

Value

No return value. The function is called for side effect. The decision rules of the given tree is printed to the console output. Users can use sink to direct the output to a file.

Examples

# Build a single tree
bt <- brifTree(Species ~., data = iris, depth = 3)

# Print out the decision rules
printRules(bt)

# Get the training accuracy
sum(predict(bt, newdata = iris, type = 'class') == iris[,'Species'])/nrow(iris)


[Package brif version 1.4.1 Index]