Learn R Programming

brif (version 1.4.1)

printRules: Print the decision rules of a brif tree

Description

Print the decision rules of a brif tree

Usage

printRules(object, which_tree = 0)

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.

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.

Examples

Run this code
# 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)

Run the code above in your browser using DataLab