cascade_root_node

View page source

Cascade Fits Starting at Root Node

Prototype

# at_cascade.cascade_root_node
def cascade_root_node(
    all_node_database       ,
    fit_goal_set            ,
    no_ode_fit              = False,
    fit_type_list           = [ 'both', 'fixed' ]
) :
    assert type(all_node_database)  == str
    assert type(fit_goal_set)       == set
    assert type(no_ode_fit)         == bool
    assert type(fit_type_list)      == list

all_node_database

is a python string specifying the location of the all_node_db relative to the current working directory.

fit_goal_set

This is a set with elements of type int (str) specifying the node_id (node_name) for each element of the fit_goal_set . Each such node must be the root node, or a descendant of the root node. In addition, it must be in the fit_goal_table , or an ancestor of a node in the fit goal table.

no_ode_fit

if True ( False ) the no_ode_fit routine will (will not) be used to modify the mean of the parent value and difference priors.

fit_type_list

This is a list with one or two elements and its possible elements are both and fixed. For each job, the first type of fit is attempted. If it fails, and there is a second type of fit, it is attempted. If it also fails, the corresponding job fails.

root_fit_database

This database is located at

result_dir/root_node_name/dismod.db

see result_dir and root_node_name. If no_ode_fit is True ( False ) the priors in the root_database are modified (are not modified) before the root node is fit; see root_database . Upon return, this is a fit_database with the extra properties listed below:

Version

The at_cascade and dismod_at version numbers are stored at the beginning of the log table in the root_fit_database .

Output dismod.db

Upon return for cascade_root_node, the results for the fits are in dismod.db in the corresponding directory relative to result_dir; i.e., sub-directory of result_dir . The .csv files can be created using the dismod_at db2csv command. The dismod_at function plot_rate_fit and plot_data_fit can be used to crate the corresponding plots.

The root level fit the directory is root_node_name . If the current fit is just before a split, there will be a sub-directory for the fit of each split_reference_name after the split. Otherwise there will be a sub-directory for the fit of each child of the node corresponding to the current fit. You can determine the directory, relative to result_dir corresponding to a fit using the get_database_dir function.

fit_var

The fit_var table correspond to the posterior mean for the model variables for this job; i.e., this fit_node_id and split_reference_id.

sample

The sample table contains the corresponding samples from the posterior distribution for the model variables for this job.

log

The log table contains a summary of the operations preformed on dismod.db between it’s input and output state.