Module buildtree :: Class buildTree
[hide private]
[frames] | no frames]

Class buildTree

source code

implement tree building methods described in Koza I/II. The buildTree() method is the constructor for a tree and contains the relevant functions.

Instance Methods [hide private]
 
setRandomLeafChild(self, parent, child_nb)
Set the a random leaf node
source code
 
setRandomBranchChild(self, parent, child_nb)
Set the a random branch node
source code
 
setRandomBranchWithTerminalSet(self, parent, child_nb)
Set an random branch child node which has terminals
source code
 
setRandomBranchWithFunctionSet(self, parent, child_nb)
Set an random branch child node which has terminals
source code
 
AddFullNode(self, parent, depth, maxdepth)
Build a tree using Koza Full Algorithm
source code
 
AddGrowNodeMin(self, parent, depth, mindepth, maxdepth)
Build a tree using Koza Half Algorithm
source code
 
AddHalfNode(self, parent, depth, mindepth, maxdepth)
Build a tree using Koza Ramped Half-n-Half
source code
Method Details [hide private]

setRandomLeafChild(self, parent, child_nb)

source code 

Function: setRandomLeafChild

Set the a random leaf node

Parameters:
  • parent - the parent node (generally a root node) e.g. (0,2,'root')
  • child_nb - the child node position (0 for first, 1 for second and so on...)
Returns:
the random leaf child node e.g. (3,0,'x')

setRandomBranchChild(self, parent, child_nb)

source code 

Function: setRandomBranchChild

Set the a random branch node

Parameters:
  • parent - the parent node (generally a root node) e.g. (0,2,'root')
  • child_nb - the child node position (0 for first, 1 for second and so on...)
Returns:
the random branch child node e.g. (1,2,'*')

setRandomBranchWithTerminalSet(self, parent, child_nb)

source code 

Function: setRandomBranchWithTerminalSet

Set an random branch child node which has terminals

Parameters:
  • parent - the parent node (generally a root node) e.g. (0,2,'root')
  • child_nb - the child node position (0 for first, 1 for second and so on...)
Returns:
the branch child node e.g. (1,2,'*')

setRandomBranchWithFunctionSet(self, parent, child_nb)

source code 

Function: setRandomBranchWithTerminalSet

Set an random branch child node which has terminals

Parameters:
  • parent - the parent node (generally a root node) e.g. (0,2,'root')
  • child_nb - the child node position (0 for first, 1 for second and so on...)
Returns:
the branch child node e.g. (1,2,'*')

AddFullNode(self, parent, depth, maxdepth)

source code 

Function: AddFullNode2

Build a tree using Koza Full Algorithm

Parameters:
  • parent - the parent node (generally a root node) e.g. (0,2,'root')
  • depth - starting depth (0 when building a tree from scratch)
  • maxdepth - max tree depth (in principle unlimited - careful with memory limitation through :))
Returns:
returns a tree built using Koza Full

AddGrowNodeMin(self, parent, depth, mindepth, maxdepth)

source code 

Function: AddFullNode2

Build a tree using Koza Half Algorithm

Parameters:
  • parent - the parent node (generally a root node) e.g. (0,2,'root')
  • depth - starting depth (0 when building a tree from scratch)
  • mindepth - min tree depth
  • maxdepth - max tree depth (in principle unlimited - careful with memory limitation through :))
Returns:
returns a tree built using Koza Full

AddHalfNode(self, parent, depth, mindepth, maxdepth)

source code 

Function: AddHalfNode

Build a tree using Koza Ramped Half-n-Half

Parameters:
  • parent - the parent node (generally a root node) e.g. (0,2,'root')
  • depth - starting depth (0 when building a tree from scratch)
  • mindepth - min tree depth (only works with 2 in the present version)
  • maxdepth - max tree depth (in principle unlimited - careful with memory limitation through :))
Returns:
returns a tree built using Koza Ramped Half-n-Half