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

[DRAFT] Coherent random numbers #133

Closed
wants to merge 35 commits into from
Closed

[DRAFT] Coherent random numbers #133

wants to merge 35 commits into from

Conversation

daniel-klein
Copy link
Contributor

Optionally use multiple random number streams and other tricks to maintain coherence between simulations.

Enabled by the multistream option and only fully compatible with the simple_embedding network.

See #73 and #118.

…f variable between simulations. Experimenting in ART.

Added logic to do transmission by acquiring node rather than edge. Slow, but rng safe.

Discovered np.random.poisson in Gonorrhea set_prognosis - likely needs to be passed index of infecting agent, which I do not currently calculate. TODO!
* Redo transmission and identification of source
* Added a poisson stream
* Initializing intervention streams
* Now set prognosis based on infector UID
…f of concept. Added a PrEP intervention that's like ART but modifies rel_sus.
* Breaking relationships on death
* Now calling finalize
* ART reduces transmission
* In ART and PrEP, changed capacity to coverage
* Bug fix in networks
* Updated "simple.py" example, need more testing
…mit that simple.py now runs two simulations and visualizes them side by side for each time step.
* Making ART reduce transmission
* Added a simple "ladder" network in which 1<-->2, 3<-->4, ... for testing purposes
* Improved graph visualization in simple.py, but will likely revert this to a simple test later.
* Adding simple_ladder.py to run and plot the ladder network
* One member of each dyad is initally HIV+
* 50% of HIV+ are on ART
* Added checking to ensure a stream is not called twice in a row without a reset() or a step()
* Improving test for Stream object.
* Improving streams.py:
 - Exception handling
 - reset()
 - Avoiding dependence of Stream on Sim object, now taking a Streams object and a block_size_object.
* module streams by layer, about to fix.
* Checking for repeat stream names.
* Adding run_multistream.py to compare a simple HIV simulation with and without random stream coherence.

* Stream block size now determined automatically

* Stream seed offsets are now determined by hashing the stream name instead of sequentially. Thanks to @RomeshA for the suggestion.

* New transmission calcs. Now determining acquisition probability across all layers and edge directions before using one random draw to determine acquisition.
* This change makes it more challenging to determine whom the infection came from, that is currently a N^2 operation that needs optimization.

* Adding ability to disable multiple streams through parameter named "multistream"
* The ability switch from MultiStream (the default) to CentralizedStream adds some complexity. Consider removing this feature later.
* As a result, everything now has parameters.

* Fixed prevalence calculation to include only people who are alive in the denominator.

* Additional error checking for streams, for example when the index array is boolean or empty.

* The _pre_draw decorator is now applied to more MultiStream calls for error checking.

* New CentralizedStream class that behaves like MultiStream but calls into a centralized random number generator.

* Fixed a small bug in states.py regarding the size of grow().

* Improved stream and streams tests.
* renaming stable_monogamy.py to run_stable_monogamy.py
* Adjusting test_base.py, it need some work to restore test_networks()
* Now using scipy to compute the distance matrix, it's faster
* Added a normal draw to streams.
* run_multistream now compares multstrem on and off for either ART or PrEP
* New run_sweep.py sweeps beta with multstream on or off
Interface still a bit messy.
Need to fix Centralized RNG now.
@daniel-klein daniel-klein marked this pull request as draft October 17, 2023 22:33
* Catching edge cases
* Update and cleanup of test scripts
* Removing prep
* Making art_efficacy a parameter
* Removed step from negative binomial
@daniel-klein
Copy link
Contributor Author

Much-improved v2 on the way.

@daniel-klein daniel-klein deleted the rng-merge branch November 13, 2023 17:07
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 this pull request may close these issues.

1 participant