Represents a decision tree with hyperplane branches that divide an
n-dimensional space, and unrestricted values stored at the leaf nodes
(e.g., matrices for dynamics, actions for policies, etc.)
|
|
|
|
|
|
boolean
|
|
list of DecisionTree instances
|
|
|
leaves(self)
Returns:
list of all leaf values (not necessarily unique) from L to R |
source code
|
|
DecisionTree[]
|
|
int
|
depth(self)
Returns:
the maximum distance between this node and the leaf nodes of the tree
rooted at this node (a leaf node has a depth of 0, a branch node with
two leaf nodes as children has a depth of 1, etc.) |
source code
|
|
int→Hyperplane
|
|
|
branch(self,
plane,
falseTree,
trueTree,
pruneF=True,
pruneT=True,
debug=False)
Marks this tree as a deterministic branching node |
source code
|
|
(Hyperplane,boolean)[]
|
getPath(self)
Returns:
the conditions under which this node will be reached, as a list of
(plane,True/False) tuples |
source code
|
|
|
|
|
|
|
prune(self,
comparisons=None,
debug=False,
negative=True) |
source code
|
|
|
count(self)
Returns:
a dictionary of statistics about the decision tree rooted at this
node: |
source code
|
|
|
|
|
_extractTree(self,
tree,
attributes,
values)
Extracts the rules from the given dtree structure into this tree |
source code
|
|
|
makeRules(self,
attributes=None,
values=None,
conditions=None,
debug=False,
comparisons=None)
Represents this tree as a list of rules |
source code
|
|
|
fromRules(self,
rules,
attributes,
values,
comparisons=None) |
source code
|
|
|
generateAlternatives(self,
index,
value,
test=None) |
source code
|
|
|
|
|
replace(self,
orig,
new,
comparisons=None,
conditions=[ ] )
Replaces any leaf nodes that match the given original value with the
provided new value, followed by a pruning phase |
source code
|
|
a new DecisionTree instance
|
merge(self,
other,
op)
Merges the two trees together using the given operator to combine
leaf values |
source code
|
|
a new DecisionTree instance
|
_merge(self,
other,
op,
comparisons=None,
conditions=[ ] )
Helper method that merges the two trees together using the given
operator to combine leaf values, without pruning |
source code
|
|
|
|
|
|
|
_multiply(self,
other,
comparisons=None,
conditions=[ ] ) |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parse(self,
element,
valueClass=None,
debug=False)
Extracts the tree from the given XML element |
source code
|
|