Add vectorized solver logic and testing to dev#591
Closed
jc-macdonald wants to merge 68 commits into
Closed
Conversation
Added a module for representing distributions that can be used throughout gempyor. Started with `DistributionABC` as and abstract base for all distributions. Implemented `FixedDistribution` and `NormalDistribution` using that ABC. Finally, exposed a field discriminated type to easily create distributions from config.
Added a representation for uniform distributions to `gempyor.distributions`.
Added a representation of a poisson distribution to `gempyor.distributions`
Added a representation for binomial distribution to `gempyor.distributions`.
Added a lognormal distribution to `gempyor.distributions`.
Added a truncated normal distribution to `gempyor.distributions`.
Added a representation for gamma distributions to `gempyor.distributions`
Added a representation for Weibull distributions to `gempyor.distributions`. Also, fixed a return type hint error.
Unit tests and validation for the `NormalDistribution` class in `gempyor_pkg/tests/distributions/`
Unit tests and validation for the `FixedDistribution` class in `gmepyor_pkg/tests/distributions/`. Also removal of an unused parameter in the `FixedDistribution` `.sample()` method.
Unit tests and validation for the `UniformDistribution` class in `gempyor_pkg/tests/distributions/`. Also linting from a previous commit I forgot to add.
Unit tests and validation for the `LognormalDistribution` class in `gempyor_pkg/tests/distributions/` + a fix for an issue that I created in `2c5fce5`
Add tests for the `TruncatedNormalDistribution` class from `gempyor.distributions`. Also, formatting fixes and bound fixes.
Unit tests and validation for `PoissonDIstribution` class in `gempyor.distributions`. Also, formatting and bounds fixes.
Unit tests and validation for the `BinomialDistribution` class in `gempyor.distributions`. Also a bounds fix in `distributions.py`.
Unit tests and validation for the `GammaDistribution` class of `gempyor.distributions`. Also, a bounds fix in `distributions.py`.
Unit tests and validation for the `WeibullDistribution` class of `gempyor.distributions`. Also, bounds and formatting fixes.
Co-authored-by: Timothy Willard <[email protected]>
Co-authored-by: Timothy Willard <[email protected]>
Add `BetaDistribution`, de-duplicate `rng` code, remove unnecessary `rng` tests.
…dependency. `test_spatial_groups()` relies on an inference config file used in the "slow" groups.
These tests are duplicates, which gets addressed in #570 , but for now we need to add both to the slow group to allow workflow success.
Remove old "slow" group, add timing feature to workflow for testing purposes (to be removed later).
Remove temporary time marker to ensure the test timing is appropriate.
Take 10 samples rather than 1 to reduce the risk of an identical series of samples being drawn (causing a test failure when arrays are compared).
use pydantic capabilities for default_factory Co-authored-by: Timothy Willard <[email protected]>
…ion_from_confuse_config()` This code is presently broken.
…ion_from_confuse_config()` This code is presently broken.
…ttps://github.com/HopkinsIDD/flepiMoP into incorporate-gem.distributions-into-gem.parameters
Add new `__call__` syntactic sugar to `Distributions`.
Co-authored-by: Timothy Willard <[email protected]>
Co-authored-by: Timothy Willard <[email protected]>
…ttps://github.com/HopkinsIDD/flepiMoP into incorporate-gem.distributions-into-gem.parameters
Co-authored-by: Timothy Willard <[email protected]>
…ttps://github.com/HopkinsIDD/flepiMoP into incorporate-gem.distributions-into-gem.parameters
Co-authored-by: Carl A. B. Pearson <[email protected]>
Co-authored-by: Carl A. B. Pearson <[email protected]>
…-into-gem.parameters Incorporate `gempyor.distributions` into `gempyor.parameters`
This reverts commit b24e9a3.
Collaborator
Author
|
closed do to wrong merge base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
This pull request introduces a fully vectorized and Numba-accelerated backend for epidemic simulation logic, located in vectorization_experiments.py. These functions serve as a performance-oriented alternative to the current solver implementation, which relies heavily on nested for-loops and dynamic memory access. The new backend explicitly separates the following components for modular testing and future optimization:
All operations are performed over preallocated NumPy arrays and are compatible with fastmath=True in Numba. This enables large performance gains while maintaining model fidelity.
A corresponding test suite is added under
tests/steps_rk4/test_vector_build.py. It validates shape agreements, parameter–transition consistency, correct handling of symbolic expressions, and deterministic solver behavior. All tests now pass with real 2-population configuration files as input.The backend is intended to be drop-in compatible with the current model parsing logic and configuration structure, with no required changes to existing user-facing YAML or CSV files.
A follow-up step will involve benchmarking this vectorized backend against the legacy solver to quantify speedup and memory improvements. We should also discuss where and how to surface this backend in the main package interface, e.g., as a solver="vectorized" option in run_simulation.
Does this pull request make any user interface changes?
No changes to user-facing files or CLI behavior are introduced. This PR is strictly additive: it introduces a new experimental backend and test suite without modifying the current simulation pipeline.