|
|
__init__(self,
*args,
**kwargs)
constructor
**Arguments**
- parent: the parent of this node in the tree
- name: the name of the node
- label: the node's label (should be an integer)
- data: an optional data field
- level: an integer indicating the level of this node in the hierarchy
(used for printing)
- isTerminal: flags a node as being terminal. |
source code
|
|
|
|
ClassifyExample(self,
example,
appendExamples=0)
Recursively classify an example by running it through the tree
**Arguments**
- example: the example to be classified
- appendExamples: if this is nonzero then this node (and all children)
will store the example
**Returns**
the classification of _example_
**NOTE:**
In the interest of speed, I don't use accessor functions
here. |
source code
|
|
|
|
AddChild(self,
name,
label=None,
data=None,
isTerminal=0)
Constructs and adds a child with the specified data to our list
**Arguments**
- name: the name of the new node
- label: the label of the new node (should be an integer)
- data: the data to be stored in the new node
- isTerminal: a toggle to indicate whether or not the new node is
a terminal (leaf) node. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from Tree.TreeNode:
AddChildNode,
Destroy,
GetChildren,
GetData,
GetLabel,
GetLevel,
GetName,
GetParent,
GetTerminal,
NameModel,
NameTree,
Pickle,
Print,
PruneChild,
ReplaceChildIndex,
SetData,
SetLabel,
SetLevel,
SetName,
SetParent,
SetTerminal,
__cmp__,
__str__
|