Common Model Changes
Here we have an ongoing list of model changes that are frequently needed and how to handle them. This section can continually be expanded with more examples over time.
Todo
Add to this page with other common requests over time. Include how-to type information and relevant notes.
Change Stratifications for an Observer
Often stratifications differ between V&V runs and later model runs. This allows us to identify issues or get more granular data. Since these tend to change, it’s important to know how to implement any changes.
You will need to check or edit three different files to include a stratification:
First, you’ll need to look at the
components/observers.pyfile to check that the code for your needed stratification exists or add it.Before you run the model, you’ll need to update the
model_specifications/model_spec.yamlfile to include the stratification.
Let’s walk through an example. Say we want to add a stratification of SAM treatment coverage to our child wasting observer. This would allow us to count the number of children with wasting by their SAM treatment coverage status.
First, we look at the components/observers.py file. Inside, there is the
ResultsStratifier class, which has the information for all stratification
variables. You can look through the code and see if a builder.results.register_stratification
matches with your needed stratification. In this case, there is one called
sam_treatment. If the stratification does not exist, you can either try to
write one based on the other examples in the section, or ask an engineer for help.
Second, we look at the bottom of the model_specifications/model_spec.yaml file, under
configuration and then stratification and add the new
stratification needed. For example, this is what the new code block might
look like:
1 configuration:
2 stratification:
3 child_wasting:
4 include: ['sam_treatment']
Check that both the observer name (child_wasting) and the stratification
variable name (sam_treatment) match what is found in the
components/observers.py file. You’re now ready to start the model run!
Turn off a Component in the Model
Another common request is to turn off a component in a model. This might be for V&V to test results without a risk component, or turning off an observer that isn’t needed for a particular model run.
Let’s do an example of turning off the SAM treatment component in a model (for now, let’s ignore that simply setting this to 0 coverage would probably be easier!).
In general, you’ll need to edit model_specifications/model_spec.yaml file
to change the components run. In this case, you can see the component WastingTreatment('risk_factor.severe_acute_malnutrition_treatment') which is the
SAM treatment. By commenting out this line, we will not run that componenet in the
model. More information on the model_specifications/model_spec.yaml file
is on the running simulations page.
In simple cases, commenting out this one line is all you’ll need to do! However,
you should check for a couple of things. First, sometimes model components have a separate
observer component. So for example there is both a ChildWasting() and
ChildWastingObserver() component. If you try to observe something that’s
not in the model, you will likely get an error.
Second, since we removed the SAM treatment component, we can’t have other variables be stratified by this any more. See the above section for more details, but make sure to check if you will need to change any stratifications based on the removed observers.
Lastly, just take a second to think through the model and if the component has other likely downstream effects. For example, if we removed the child wasting component from the model, the targeting for SAM and MAM treatment wouldn’t make sense any more. This will change a lot for each model, so spend a bit of time thinking through changes in the context of your model.