Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatch between rate law symbols and state variable names #189

Closed
djinnome opened this issue Jul 6, 2023 · 2 comments · Fixed by #190
Closed

Mismatch between rate law symbols and state variable names #189

djinnome opened this issue Jul 6, 2023 · 2 comments · Fixed by #190

Comments

@djinnome
Copy link
Contributor

djinnome commented Jul 6, 2023

Hi folks,

In the AMR format, rate laws are expressed as symbols using ASKENET State id not ASKENET State name,

https://github.com/indralab/mira/blob/82421e4465edfb6eb27f811726d9745afb3d28e4/mira/sources/askenet/petrinet.py#L101

but MIRA only preserves the name field (unless the name is not present), and not the id when reading the AMR into a Mira model.

https://github.com/indralab/mira/blob/82421e4465edfb6eb27f811726d9745afb3d28e4/mira/sources/askenet/petrinet.py#L229

This makes it difficult to automatically associate each sympy symbol with its corresponding state variable.
Is there a way to associate AMR ids with state variables in the MIRA model? Maybe just add id as another key in the variable.data dictionary or perhaps as an askenet:<id> in the identifiers or context attribute?

@bgyori
Copy link
Member

bgyori commented Jul 6, 2023

Yes, this can indeed happen if both an id and a name are specified and they are different. We will look into the best option to fix this.

@djinnome
Copy link
Contributor Author

djinnome commented Jul 6, 2023

The main issue is that I need a reliable way to associate a symbol with a concept. One possibility is to include the symbol as an additional attribute of the Concept

djinnome added a commit to ciemss/pyciemss that referenced this issue Jul 6, 2023
SamWitty pushed a commit to ciemss/pyciemss that referenced this issue Jul 10, 2023
* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law
anirban-chaudhuri added a commit to ciemss/pyciemss that referenced this issue Jul 10, 2023
* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

* Symbolic Rate law to Pytorch Rate law (#201)

* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
anirban-chaudhuri added a commit to ciemss/pyciemss that referenced this issue Jul 10, 2023
* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

* Symbolic Rate law to Pytorch Rate law (#201)

* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law

* 12-Month Hackathon Notebooks (#207)

* started hackathon prep scenario notebooks

* more on hackathon scenarios

* more work on hackathon notebooks

* created AMR for scenario1 with constant beta

* Vs hackathon prep (#203)

* beginning of ensemble challenge ipynb

* Update ensemble_challenge.ipynb

* added to scenario2 notebook, ready for scenario3

* added to scenario2 notebook, ready for scenario3

* Update scenario1.ipynb

* Update scenario1

* changes to scenario3, and new AMR

* pre-hackathon prep update

- scenario1 task 1 almost done (pending AMR changes)

- ensemble challenge layout started

* more on scenario notebooks, added AMR to scenario2

* Fixed the nan inside the intervened parameters column output

* updates to scenario3 notebook

* merged from main

---------

Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>
anirban-chaudhuri added a commit to ciemss/pyciemss that referenced this issue Jul 12, 2023
* Optimize TA4 interface

* Update interfaces.py

* Change setup to fix MIRA name error (#205) (#206)

* changed mira version before bug

* fix error

Co-authored-by: Sam Witty <samawitty@gmail.com>

* Update demo notebook

* Update demo.ipynb

* Update MIRA loading (#209)

* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>

* Updated interface with string inputs for QOI

* Interface to optimize after calibrating

* Update demo.ipynb

* Update sample csv file to avoid merge conflicts

* Updating file to avoid merge conflict with main

* Updating from main to fix model loading errors (#211)

* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

* Symbolic Rate law to Pytorch Rate law (#201)

* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>

* Update notebooks to avoid merge conflicts

* Update NB to resolve conflicts

* Update from main to avoid conflicts (#212)

* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

* Symbolic Rate law to Pytorch Rate law (#201)

* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law

* 12-Month Hackathon Notebooks (#207)

* started hackathon prep scenario notebooks

* more on hackathon scenarios

* more work on hackathon notebooks

* created AMR for scenario1 with constant beta

* Vs hackathon prep (#203)

* beginning of ensemble challenge ipynb

* Update ensemble_challenge.ipynb

* added to scenario2 notebook, ready for scenario3

* added to scenario2 notebook, ready for scenario3

* Update scenario1.ipynb

* Update scenario1

* changes to scenario3, and new AMR

* pre-hackathon prep update

- scenario1 task 1 almost done (pending AMR changes)

- ensemble challenge layout started

* more on scenario notebooks, added AMR to scenario2

* Fixed the nan inside the intervened parameters column output

* updates to scenario3 notebook

* merged from main

---------

Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>

* Update demo.ipynb

* Update demo.ipynb

* updated demo with new MIRA model

* Fixed setup.cfg

* Update demo.ipynb

* Updated solution key in demo

* finished demo notebook run

* Added test for samples obtained after OUU

* Update output format and description

* Fixed mira on setup to help pass tests

* Added `self.intervened_samples` to `test_ode_interfaces'

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>
anirban-chaudhuri added a commit to ciemss/pyciemss that referenced this issue Jul 13, 2023
* Added get_name on the mira parameter keys for safety (#218)

* Added get_name on the mira parameter keys for safety

* Removed test for SIDARTHE which fails due to gyorilab/mira#195

* checked out scenario1 from main so that it doesn't clobber Vignesh's changes

* Added test that confirms gyorilab/mira#196 solves gyorilab/mira#195

* Added pin to latest mira commit

* bump mira (#227)

* bump mira

* bumped AMR file

* Provisional support for time_unit in TA4 interface dataframe (#221)

* Provisional support for time_unit in TA4 interface dataframe

* Missed format identifier

* Default time-unit

* Testing time_unit behaviors

* Updating tests for new TA4 itnerface behavior

* To preserve context in failure messages, changed  to

* Decorator logging function (#232)

* Logging function name where error occurs

* updated text

* Optimize interface for TA4 integration (#204)

* Optimize TA4 interface

* Update interfaces.py

* Change setup to fix MIRA name error (#205) (#206)

* changed mira version before bug

* fix error

Co-authored-by: Sam Witty <samawitty@gmail.com>

* Update demo notebook

* Update demo.ipynb

* Update MIRA loading (#209)

* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>

* Updated interface with string inputs for QOI

* Interface to optimize after calibrating

* Update demo.ipynb

* Update sample csv file to avoid merge conflicts

* Updating file to avoid merge conflict with main

* Updating from main to fix model loading errors (#211)

* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

* Symbolic Rate law to Pytorch Rate law (#201)

* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>

* Update notebooks to avoid merge conflicts

* Update NB to resolve conflicts

* Update from main to avoid conflicts (#212)

* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

* Symbolic Rate law to Pytorch Rate law (#201)

* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law

* 12-Month Hackathon Notebooks (#207)

* started hackathon prep scenario notebooks

* more on hackathon scenarios

* more work on hackathon notebooks

* created AMR for scenario1 with constant beta

* Vs hackathon prep (#203)

* beginning of ensemble challenge ipynb

* Update ensemble_challenge.ipynb

* added to scenario2 notebook, ready for scenario3

* added to scenario2 notebook, ready for scenario3

* Update scenario1.ipynb

* Update scenario1

* changes to scenario3, and new AMR

* pre-hackathon prep update

- scenario1 task 1 almost done (pending AMR changes)

- ensemble challenge layout started

* more on scenario notebooks, added AMR to scenario2

* Fixed the nan inside the intervened parameters column output

* updates to scenario3 notebook

* merged from main

---------

Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>

* Update demo.ipynb

* Update demo.ipynb

* updated demo with new MIRA model

* Fixed setup.cfg

* Update demo.ipynb

* Updated solution key in demo

* finished demo notebook run

* Added test for samples obtained after OUU

* Update output format and description

* Fixed mira on setup to help pass tests

* Added `self.intervened_samples` to `test_ode_interfaces'

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>

* 234 visualization support for trajectory distributions (#235)

* Trajectory distribution schema

* Sample trajectory data and notebook

* Interactive legend

* Removing extraneous encoding

* replace-by-name utility added

Removes index-based replacements (a source of brittleness in the substitutions being done.)

* Types improvements and linting fixes

* Relabeling

* Example trajectories working

* calibration viz notebook

* clean up

* heatmap vega

* triangle plot in triangle_vega_demo

* Points and tracks on trajectory visualization.

* Ignoring typechecking temporaries

* Adjusting z-order

* EXPERIEMENT: dataframe based input to trajectory visualizations

* REVERTING to prep for a TA4-defined dataframe.

* Ignoring temporaries that start with an underscore.

* Joining line for provided datapoints.

* Color control.

* TA4 dataframe: Distributions and points working

* Distributions, traces and points all work from TA4 interface dataframe.

* Improved Color handling

* triangle notebook

* vega with n-dimensional heatmap

* vega with n-dimensional heatmap

* Basic timepoint markers added

* Permanantly labeled timepoint markers.

* Support to NOT join points

This is useful when the sample points are relatively dense.

* More flexible timepoint for traces.

* LotkaVolterra examples

NOTE: Its possible the `convert_to_output_format` has a bug.  It is returning step-ids, not time-values.  As-such, intervention markers were set to 250 instead of 25.

* Trajectory and barycenter/proababilty-density plots
Extended integration interface to preserve timepoint (not just timepoint_id)

Renamed 'vega' to 'plots'
Updated examples
(Some) Utility tests
Cleanup of various files

* Basic support for calibrate chart

* Calibration supports name-discovery from the dataset.

* Provisional support for time_unit in TA4 interface dataframe

* Missed format identifier

* Updated TA4 dataframe interface.

* Using 'Optional' for types instead of Union with None

* Visualzation of non-ensembles supported.

* Demo of visulaizations through the interface.

* Default time-unit

* Testing time_unit behaviors

* Updating tests for new TA4 itnerface behavior

* To preserve context in failure messages, changed  to

* Tests for visualizations; Visuals avaialble through the TA4 interface.

---------

Co-authored-by: Oostrom, Marjolein T <marjolein.oostrom@pnnl.gov>

* add json files to package (#240)

* Updated setup.cfg to work with pyciemss install (#242)

* add json files to package

* For some reason the last pr worked locally but not with the simulation service install. hoping this solves it

---------

Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Joseph Cottam <jacottam@gmail.com>
Co-authored-by: marshHawk4 <kyle@jataware.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>
Co-authored-by: Oostrom, Marjolein T <marjolein.oostrom@pnnl.gov>
SamWitty added a commit to ciemss/pyciemss that referenced this issue Jul 13, 2023
* Ensemble quantiles

- Updated `convert_to_output_format` to return quantiles for ensemble models

* Updated utilities to produce quantiles as extra output for ensembles

* Update sample_results.csv

resolving conflicts with main branch

* Updating from main (#230)

* Added get_name on the mira parameter keys for safety (#218)

* Added get_name on the mira parameter keys for safety

* Removed test for SIDARTHE which fails due to gyorilab/mira#195

* checked out scenario1 from main so that it doesn't clobber Vignesh's changes

* Added test that confirms gyorilab/mira#196 solves gyorilab/mira#195

* Added pin to latest mira commit

* bump mira (#227)

* bump mira

* bumped AMR file

---------

Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: Sam Witty <samawitty@gmail.com>

* Update interface_utils.py

* Data formatting update

* Added options for data formatting

* Finalized notebook

* resolving conflicts with main for notebook

* resolving conflicts in csv files

* resolving conflicts with main

* resolving conflict on rate law test

* resolving conflicts on interfaces

* Update from main branch (#249)

* Added get_name on the mira parameter keys for safety (#218)

* Added get_name on the mira parameter keys for safety

* Removed test for SIDARTHE which fails due to gyorilab/mira#195

* checked out scenario1 from main so that it doesn't clobber Vignesh's changes

* Added test that confirms gyorilab/mira#196 solves gyorilab/mira#195

* Added pin to latest mira commit

* bump mira (#227)

* bump mira

* bumped AMR file

* Provisional support for time_unit in TA4 interface dataframe (#221)

* Provisional support for time_unit in TA4 interface dataframe

* Missed format identifier

* Default time-unit

* Testing time_unit behaviors

* Updating tests for new TA4 itnerface behavior

* To preserve context in failure messages, changed  to

* Decorator logging function (#232)

* Logging function name where error occurs

* updated text

* Optimize interface for TA4 integration (#204)

* Optimize TA4 interface

* Update interfaces.py

* Change setup to fix MIRA name error (#205) (#206)

* changed mira version before bug

* fix error

Co-authored-by: Sam Witty <samawitty@gmail.com>

* Update demo notebook

* Update demo.ipynb

* Update MIRA loading (#209)

* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>

* Updated interface with string inputs for QOI

* Interface to optimize after calibrating

* Update demo.ipynb

* Update sample csv file to avoid merge conflicts

* Updating file to avoid merge conflict with main

* Updating from main to fix model loading errors (#211)

* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

* Symbolic Rate law to Pytorch Rate law (#201)

* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>

* Update notebooks to avoid merge conflicts

* Update NB to resolve conflicts

* Update from main to avoid conflicts (#212)

* Change setup to fix MIRA name error (#205)

* changed mira version before bug

* fix error

* Add utilities for loading distributions from AMR (#200)

* added mira distribution loading

* added normal distribution

* fixed Normal2 and Normal3

* nit

* added minimal mira_distribution_to_pyro test

* Symbolic Rate law to Pytorch Rate law (#201)

* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law

* 12-Month Hackathon Notebooks (#207)

* started hackathon prep scenario notebooks

* more on hackathon scenarios

* more work on hackathon notebooks

* created AMR for scenario1 with constant beta

* Vs hackathon prep (#203)

* beginning of ensemble challenge ipynb

* Update ensemble_challenge.ipynb

* added to scenario2 notebook, ready for scenario3

* added to scenario2 notebook, ready for scenario3

* Update scenario1.ipynb

* Update scenario1

* changes to scenario3, and new AMR

* pre-hackathon prep update

- scenario1 task 1 almost done (pending AMR changes)

- ensemble challenge layout started

* more on scenario notebooks, added AMR to scenario2

* Fixed the nan inside the intervened parameters column output

* updates to scenario3 notebook

* merged from main

---------

Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>

* Update demo.ipynb

* Update demo.ipynb

* updated demo with new MIRA model

* Fixed setup.cfg

* Update demo.ipynb

* Updated solution key in demo

* finished demo notebook run

* Added test for samples obtained after OUU

* Update output format and description

* Fixed mira on setup to help pass tests

* Added `self.intervened_samples` to `test_ode_interfaces'

---------

Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>

* 234 visualization support for trajectory distributions (#235)

* Trajectory distribution schema

* Sample trajectory data and notebook

* Interactive legend

* Removing extraneous encoding

* replace-by-name utility added

Removes index-based replacements (a source of brittleness in the substitutions being done.)

* Types improvements and linting fixes

* Relabeling

* Example trajectories working

* calibration viz notebook

* clean up

* heatmap vega

* triangle plot in triangle_vega_demo

* Points and tracks on trajectory visualization.

* Ignoring typechecking temporaries

* Adjusting z-order

* EXPERIEMENT: dataframe based input to trajectory visualizations

* REVERTING to prep for a TA4-defined dataframe.

* Ignoring temporaries that start with an underscore.

* Joining line for provided datapoints.

* Color control.

* TA4 dataframe: Distributions and points working

* Distributions, traces and points all work from TA4 interface dataframe.

* Improved Color handling

* triangle notebook

* vega with n-dimensional heatmap

* vega with n-dimensional heatmap

* Basic timepoint markers added

* Permanantly labeled timepoint markers.

* Support to NOT join points

This is useful when the sample points are relatively dense.

* More flexible timepoint for traces.

* LotkaVolterra examples

NOTE: Its possible the `convert_to_output_format` has a bug.  It is returning step-ids, not time-values.  As-such, intervention markers were set to 250 instead of 25.

* Trajectory and barycenter/proababilty-density plots
Extended integration interface to preserve timepoint (not just timepoint_id)

Renamed 'vega' to 'plots'
Updated examples
(Some) Utility tests
Cleanup of various files

* Basic support for calibrate chart

* Calibration supports name-discovery from the dataset.

* Provisional support for time_unit in TA4 interface dataframe

* Missed format identifier

* Updated TA4 dataframe interface.

* Using 'Optional' for types instead of Union with None

* Visualzation of non-ensembles supported.

* Demo of visulaizations through the interface.

* Default time-unit

* Testing time_unit behaviors

* Updating tests for new TA4 itnerface behavior

* To preserve context in failure messages, changed  to

* Tests for visualizations; Visuals avaialble through the TA4 interface.

---------

Co-authored-by: Oostrom, Marjolein T <marjolein.oostrom@pnnl.gov>

* add json files to package (#240)

* Updated setup.cfg to work with pyciemss install (#242)

* add json files to package

* For some reason the last pr worked locally but not with the simulation service install. hoping this solves it

---------

Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Joseph Cottam <jacottam@gmail.com>
Co-authored-by: marshHawk4 <kyle@jataware.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>
Co-authored-by: Oostrom, Marjolein T <marjolein.oostrom@pnnl.gov>

* Added back changes for quantile estimations

* Added time units

* Update test_ensemble_interfaces.py

---------

Co-authored-by: Jeremy Zucker <djinnome@gmail.com>
Co-authored-by: Sam Witty <samawitty@gmail.com>
Co-authored-by: Joseph Cottam <jacottam@gmail.com>
Co-authored-by: marshHawk4 <kyle@jataware.com>
Co-authored-by: sabinala <130604122+sabinala@users.noreply.github.com>
Co-authored-by: vsella <vsella@utexas.edu>
Co-authored-by: Jeremy Zucker <Jeremy.Zucker@pnnl.gov>
Co-authored-by: Oostrom, Marjolein T <marjolein.oostrom@pnnl.gov>
marjoleinpnnl pushed a commit to ciemss/pyciemss that referenced this issue Aug 10, 2023
* I believe I wrote the correct code, based on experiments in the notebook. Will test next.

* FAILED test/test_mira/test_rate_law.py::TestRateLaw::test_rate_law_compilation - AttributeError: 'ScaledBetaNoisePetriNetODESystem' object has no attribute 'beta'

* Added Symbolic_Deriv_Experiments notebook

* Something weird is happening. I can confirm that 'beta' is an attribute of ScaledBetaNoisePetriNetODESystem after setting up the model, but then it can't be found at sample time

* Clarified the bug in the Symbolic derivatives notebook

* Expected and actual derivative match

* Time varying parameter rate law correctly read

* Thought we added this already

* Added kwargs to from_askenet and from_mira and compile_rate_law_p to load_petri_net

* Blocked on gyorilab/mira#189 but tests pass by making compile_rate_law_p False by default

* Removed unnecessary pygraphviz dependency

* Unit test to fail when concept name does not equal rate law symbols

* All tests pass with default compile_rate_law_p = False

* Merged from main. removed dependency on older version of mira

* point mira to the github repo main branch

* point mira to the github repo main branch

* load_and_calibrate_and_sample(..., compile_rate_law_p=True) works with the caveat that the ScaledBetaNoisePetriNetODESystem solution was returning very slightly negative values, so I set mean = torch.abs(solution[var_name]) to address the issue

* merged changes to MiraPetriNetODESystem and ScaledBetaNoisePetriNetODESystem from main.  ScaledBetaNoisePetriNetODESystem has default compiled_rate_law_p=True

* observation_function for ScaledBetaNoisePetriNetODESystem now uses torch.maximum(solution[var_name], torch.tensor(1e-9)) to deal with overshooting derivatives

* aggregate parameters is now by default opt-out, and AMR models with multiple parameters per transition can be interpreted using compile_rate_law
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants