Closed MichaelTiemannOSC closed 7 months ago
Hello Michael,
Thanks a lot for your valuable contribution.
A few remarks regarding your contribution before merge :
It should be great to have the possibility to activate/deactivate your new pandemic effect feature with a flag.
we are using gradient based algorithms for the resolution of WITNESS MDA and MDOs. To enhance performances, analytic gradients are used and specifically implemented in the population_discipline. Could you update the analytic gradient in the compute_sos_jacobian method ? We definitely need to document this part of the code so if you have any questions feel free to ask.
The documentation of the population model need to be upgraded with this new feature. You can do that on the population_discipline.md file in the documentation folder. We are currently working on a detailed methodology and procedure to accept merge request related to WITNESS models improvements. Thanks again it will help us to properly define this procedure.
Regarding your issue, if you update the grammar in the population discipline (in the DESC-IN), you should see the input widget on the platform (once updated).
Agree on all points.
The docs are a bit sketchy. Where should I find flag
documenation? I found reference to the word flag in l0_test_population_discipline.py
and a mechanism here:
assumptions_dict = ClimateEcoDiscipline.assumptions_dict_default
assumptions_dict['activate_climate_effect_population'] = False
It looks like each discipline has its own assumptions_dict
, so I'll try to update the correct one.
On the gradient front, I initially planned for the pandemic to act as a universal force, but on second thought there are some other factors: the first year of the pandemic, a certain percentage of the population is infected. The next year, it spreads both to new victims, but can also reinfect previous victims. The cumulative effects of reinfection appear particularly bad for COVID. So what I'm thinking is that at the very least there should be some kind of exponential infection effect that spreads through the population (related to r-factor). In that case we can look up the probabilities of disabling Long Covid upon first infection and also the death rates of first infections. Later we can add the re-infection effect. We can also add a vaccine diffusion and vaccine effectiveness rate (which seems to affect the death rates, but not necessarily Long Covid).
I would be very happy to schedule a session where we could work this out on a virtual chalkboard. I'm sure I could grovel the information out slowly by sleuthing, but I suspect is the kind of thing that we could sort in an hour.
On the documentation front, I see two things. First, I found both population_discipline.md
and how_to_model_a_study.md
. But I also found that in many places the documentation is just a stub file, or missing. I think it would be helpful for the documentation to refer to python files (as it sometimes does) and also for python files to reference the relevant places in the doc files (so that people know where to update things as they make enhancements).
I'll look at modifying the grammar. Thanks!
Regarding the grammar of DESC_IN
, I added these:
GlossaryCore.PandemicParamDf['var_name']: desc_in_default_pandemic_param,
'pandemic_param': {'type': 'dataframe', 'default': desc_in_default_pandemic_param['default'], 'unit': '-',
'dataframe_descriptor': {'param': ('string', None, False),
'disability': ('float', None, False),
'mortality': ('float', None, False),}
},
What am I missing?
Hello Michael,
I will attempt to answer some of your questions:
I mentioned flags, but the concept is to include a boolean as an input for the model to activate or deactivate pandemic effects in the code. Creating an assumptions_dict to collect all these booleans is a good option; please create one if it doesn't exist in the population model.
Regarding gradient implementation the idea is to implement analytically all gradients between outputs of the model that are coupling variables (for population only population_df and working_age_population_df) vs inputs of the model that are also coupling variables or design variables of the optimization process (calories_pc_df, economy_df,temperature_df). All these gradients are for the resolution of MDO and MDAs.
More technically, because your new devs haven't modified the I/O of the model you just need to update the gradients already implemented in the population model :
d population_df /deconomy_df in compute_d_pop_d_output method
working_age_population_df /deconomy_df in compute_d_pop_d_output method
d population_df /dtemperature_df in compute_d_pop_d_temp
d population_df /dcalories_pc_df in compute_d_pop_d_kcal_pc
-Regarding documentation, the how_to_model_a_study.md is a work in progress and is not relevant or complete. For each discipline, you have a .md file with the name of the discipline in a documentation folder. We are actively working on a documentation guide on how to improve/create your documentation model. We are also working with Sphinx to create documentation for Sostrades with Python files.
-Finally, for the desc_in, it looks great. If your GUI is updated, you should see a new widget in your study.
Regards,
Valentin Joncquieres
Good news...at this point the GUI is showing the pandemic data frame. Moreover, I can load new values via CSV files so I don't have to stop, delete, rebuild, and restart the server just to change some values. I still have to work out the gradient math, and that really depends more on me getting comfortable with how the pandemic model sits across the Workforce calculation (if it does) than the working age population model (which it currently does).
Hello Michael,
Good news that the False to True worked well.
Workforce population is directly extracted from working age population. If you didn’t modify the employment rate variable (which is fixed for now) it should work without any issue if you upated the population or working population.
Best regards,
Matthieu
From: Michael Tiemann @.> Sent: Monday, March 11, 2024 2:51 AM To: os-climate/witness-core @.> Cc: Matthieu Meaux @.>; Mention @.> Subject: Re: [os-climate/witness-core] Covid model (PR #7)
This mail has been sent from an external source. Do not reply to it, or open any links/attachments unless you are sure of the sender's identity.
Good news...at this point the GUI is showing the pandemic data frame. Moreover, I can load new values via CSV files so I don't have to stop, delete, rebuild, and restart the server just to change some values. I still have to work out the gradient math, and that really depends more on me getting comfortable with how the pandemic model sits across the Workforce calculation (if it does) than the working age population model (which it currently does).
— Reply to this email directly, view it on GitHubhttps://github.com/os-climate/witness-core/pull/7#issuecomment-1987489753, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXELDL3ZK7TXJ3TYA4TO5HLYXULZ3AVCNFSM6AAAAABDZGWRJGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGQ4DSNZVGM. You are receiving this because you were mentioned.Message ID: @.**@.>> This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
Refactored pandemic effects so that disability (due to long covid) affects employment rate in the macroeconomics model and mortality affects death rate in the population model. Comments welcome as to whether I've followed the right patterns in doing this.
I continue to update the changes with the validation branch but if those merges are re-creating history and/or creating confusion, let me know what you'd like me to fix.
Hi Michael, I think it's good practice for us to take and handle these inputs properly, and AFAIK when discussed this morning it was not creating chaos, so I'd advocate to continue :-) Best regards, Thierry
Le jeu. 14 mars 2024 à 11:08, Michael Tiemann @.***> a écrit :
Refactored pandemic effects so that disability (due to long covid) affects employment rate in the macroeconomics model and mortality affects death rate in the population model. Comments welcome as to whether I've followed the right patterns in doing this.
I continue to update the changes with the validation branch but if those merges are re-creating history and/or creating confusion, let me know what you'd like me to fix.
— Reply to this email directly, view it on GitHub https://github.com/os-climate/witness-core/pull/7#issuecomment-1997085264, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXHREL2Z3TLPBHBTAULKQQ3YYFZJZAVCNFSM6AAAAABDZGWRJGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJXGA4DKMRWGQ . You are receiving this because you were mentioned.Message ID: @.***>
These changes attempt to demonstrate how some new topic, such as the effects of a pandemic, can affect both the available workforce (diminished due to Long Covid) and total population (due to excess deaths). This could be something that gets related to temperature (increases lead to more zoonotic threats), and it could be something where each pandemic runs it own course over a 100 year period. But right now its written to just layer effects onto the workforce and death rates (not birth rates) as a constant drag.
I could not figure out how to get a displayable node in the
Input parameters
section ofData management
. If I could have, it would make it a lot easier to upload new data files and re-run models without the need to rebuild everything from scratch every time. Feel free to drop comments in the code review.@ sostrades-pjbarjhoux @sostrades-matthieu-meaux @sostrades-tchevalier