Cascade Commands

Cascade Commands

Sequences of cascade operations that work together to create a cascade command that will run the whole cascade (or a drill – which is a version of the cascade).

class cascade_at.cascade.cascade_commands._CascadeCommand[source]

Bases: object

Initializes a task dictionary. All tasks added to this command in the form of cascade operations are added to the dictionary.

self.task_dict

A dictionary of cascade operations, keyed by the command for that operation. This is so that we can look up the task later by the exact command.

add_task(cascade_operation)[source]

Adds a cascade operation to the task dictionary.

Parameters

cascade_operation (_CascadeOperation) – A cascade operation to add to the command dictionary

Return type

None

get_commands()[source]

Gets a list of commands in sequence so that you can run them without using jobmon.

Returns

Return type

Returns a list of commands that you can run on the command-line.

class cascade_at.cascade.cascade_commands.Drill(model_version_id, drill_parent_location_id, drill_sex, n_sim, n_pool=10, skip_configure=False)[source]

Bases: cascade_at.cascade.cascade_commands._CascadeCommand

A cascade command that runs a drill model, meaning that it runs one Dismod-AT model with a parent plus its children.

Parameters
  • model_version_id (int) – The model version ID to create the drill for

  • drill_parent_location_id (int) – The parent location ID to start the drill from

  • drill_sex (int) – Which sex to drill for

  • n_sim (int) – The number of simulations to do to get uncertainty at the leaf nodes

  • n_pool (int) – The number of threads to create in a multiprocessing pool. If this is 1, then it will not do multiprocessing.

class cascade_at.cascade.cascade_commands.TraditionalCascade(model_version_id, split_sex, dag, n_sim, n_pool=10, location_start=None, sex=None, skip_configure=False)[source]

Bases: cascade_at.cascade.cascade_commands._CascadeCommand

Runs the “traditional” dismod cascade. The traditional cascade as implemented here runs fit fixed all the way to the leaf nodes of the cascade to save time (rather than fit both). To get posterior to prior it uses the coefficient of variation to get the variance of the posterior that becomes the prior at the next level. At the leaf nodes to get final posteriors, it does sample asymptotic. If sample asymptotic fails due to bad constraints it does sample simulate instead.

Parameters
  • model_version_id (int) – The model version ID

  • split_sex (bool) – Whether or not to split sex

  • dag (LocationDAG) – A location dag that specifies the structure of the cascade hierarchy

  • n_sim (int) – The number of simulations to do to get uncertainty at the leaf nodes

  • n_pool (int) – The number of threads to create in a multiprocessing pool. If this is 1, then it will not do multiprocessing.

  • location_start (Optional[int]) – Which location to start the cascade from (typically 1 = Global)

  • sex (Optional[int]) – Which sex to run the cascade for (if it’s 3 = Both, then it will split sex, if it’s 1 or 2, then it will only run it for that sex.

  • skip_configure (bool) – Use this option to skip the initial inputs pulling; should only be used in debugging cases by developers.