get_fit_children

View page source

Determine the Set of Nodes to Fit

Prototype

# at_cascade.get_fit_children
def get_fit_children(
   root_node_id  ,
   fit_goal_set  ,
   node_table    ,
) :
   assert type( root_node_id ) == int
   assert type( fit_goal_set ) == set
   assert type( node_table ) == list
   # ...
   assert type(fit_children) == list
   ok = False
   for node_id in fit_goal_set :
      ok = ok or len( fit_children[node_id] ) == 0
   assert ok
   return fit_children

root_node_id

This is the node_id in the node_table for the root_node.

fit_goal_set

This is a set with elements of type int specifying the node_id for each element of the fit_goal_set or fit_goal_table .

node_table

This is python list of python dictionaries containing the dismod_at node table.

fit_children

The return value fit_children is a python list of python sets.

For each node_id fit_children [ node_id ] is a the set of node ids that are children of node_id and must be fit in order to fit all the nodes in fit_goal_set.

Note that there must be at least one node_id in fit_goal_set , that is not an ancestor of any node in fit_goal_set and hence len( fit_children [ node_id ] ) = 0 .