# rfgb.tree module¶

Data structures and methods for learning decision trees.

class rfgb.tree.node(test=None, examples=None, information=None, level=None, parent=None, pos=None)[source]

Bases: object

A node in a tree.

Parameters: expandQueue – Breadth first search node expansion strategy depth – initial depth is 0 because no node present maxDepth – max depth set to 1 because we want to at least learn a tree of depth 1 learnedDecisionTree – this will hold all the clauses learned data – stores all the facts, positive and negative examples
data = None
depth = 0
expandOnBestTest(data=None)[source]

Expand the node based on the best test.

expandQueue = []
getTrueExamples(clause, test, data)[source]

Returns all examples that satisfy the clause with conjoined test literal.

static initTree(trainingData)[source]

Create the root node of the tree.

static learnTree(data)[source]

Method to create and learn the decision tree.

learnedDecisionTree = []
maxDepth = 1
static setMaxDepth(depth)[source]

Set the maximum depth of the tree.