Skip to content

Releases: epistorm/epydemix

v1.3.1

Choose a tag to compare

@ngozzi ngozzi released this 02 Jul 14:00

Fixed

  • pyproject.toml now lists numba as an optional extra (pip install epydemix[numba]), restoring the JIT-compiled speedup for _multinomial_probs (the hot path in stochastic simulation) advertised in the 1.2.0 changelog entry. requirements.txt and setup.py have listed numba>=0.57.0 since 1.2.0, but pyproject.toml's dependencies was never updated to match — since PyPI installs are driven by pyproject.toml, pip install epydemix never actually installed numba, silently falling back to the un-JIT'd Python path (no crash: utils.py already wraps the import in a try/except with a no-op decorator fallback). numba's own hard dependency, llvmlite, bundles LLVM and is 40-60MB per wheel, so it's exposed as an opt-in extra rather than a base dependency.

Full changelog: https://github.com/epistorm/epydemix/blob/main/CHANGELOG.md#131---2026-07-02

v1.3.0

Choose a tag to compare

@ngozzi ngozzi released this 01 Jul 14:04

What's new

Changed

  • Breaking: add_outcome now interprets mortality_rate / hospitalization_rate as the fraction of the Infected outflow that goes to Dead / Hospitalized, rescaling the existing Infected outflow (e.g. Infected → Recovered) by (1 - rate). Previously these were independent day⁻¹ rates competing with recovery_rate for the same Infected pool. This matches the branching-fraction convention already used by asymptomatic_fraction in create_seiar. If you use outcome=, pass the intended fraction (e.g. 0.02 for "2% hospitalized") rather than a standalone rate.

Fixed

  • add_vaccination now routes breakthrough infections (Vaccinated → ...) to Exposed when the backbone has an Exposed compartment (SEIR, SEIAR), instead of always jumping straight to Infected. Vaccinated individuals who get infected now correctly re-enter the incubation stage. Behavior for SIR/SIS is unchanged.
  • apply_initial_conditions now raises a clear ValueError when initial_conditions_dict contains a compartment name not present in the model, instead of silently ignoring the mismatched key and leaving the intended compartment at 0 population. Fixes #20.
  • stochastic_simulation no longer double-counts recorded transition counts when a model has two or more transitions sharing the same (source, target) pair (e.g. SEIAR's Susceptible → Exposed, mediated by both Infected and Asymptomatic). Compartment populations were never affected — only the recorded transition trajectory (previously ~2x the true flow for the affected pair).
  • Fixed a flaky calibration test caused by an unseeded population fixture that could occasionally sample a zero-population age group.

Full Changelog: https://github.com/epistorm/epydemix/blob/main/CHANGELOG.md

v1.2.1

Choose a tag to compare

@ngozzi ngozzi released this 15 May 14:30

What's new

Added

  • New SEIAR backbone model: symptomatic + asymptomatic infectious compartments, with parameters asymptomatic_fraction, asymptomatic_recovery_rate, and asymptomatic_relative_infectivity.
  • Three orthogonal modular extensions composable on any backbone via load_predefined_model flags:
    • waning_immunity=True — adds R → S transition (SIRS, SEIRS dynamics); waning_rate defaults to 1/365 (~1 year of immunity)
    • vaccination=True — adds a Vaccinated compartment with S → V → I at reduced rate controlled by vaccine_efficacy
    • outcome="deaths" or outcome="hospitalization" — adds Dead or Hospitalized compartment branching from Infected
  • SUPPORTED_MODELS updated to ["SIR", "SEIR", "SIS", "SEIAR"].
  • All new rate parameters accept scalars, 1D time-varying arrays (T,), or 2D age-stratified arrays (T, G).
  • Tutorial 12: Predefined Epidemic Models — demonstrates all backbones and modular extensions.

Fixed

  • create_default_initial_conditions now correctly seeds all new model combinations: deduplicates transition sources, excludes accumulator compartments (Vaccinated, Exposed, Hospitalized, Dead) from initial population, and handles waning-immunity models where Susceptible is both a source and a target.

v1.2.0

Choose a tag to compare

@ngozzi ngozzi released this 12 May 13:03
2b38fc0

What's Changed

Added

  • US county-level geographies (~3,144 locations) from epydemix-data v1.2.0. Counties are stored using the Country__State__County_Name naming convention (e.g., United_States__Alabama__Autauga_County).
  • locations.csv new columns: level (0=country, 1=state/province/region, 2=US county) and iso_code (ISO 3166-1 alpha-2 for countries, ISO 3166-2 for states, 5-digit FIPS for counties).
  • get_available_locations() level filter: optional parameter to filter by geographic level. Backward-compatible with data_version="v1.1.0".
  • Numba JIT compilation for the multinomial probability computation (_multinomial_probs in utils.py), eliminating interpreter overhead on the hot simulation path.

Changed

  • Location names now use _ for spaces within a name and __ as a hierarchy separator (e.g., United_States__Alabama__Autauga_County). Existing country and state names have been renamed consistently.
  • Default data_version bumped from "v1.1.0" to "v1.2.0" across load_epydemix_population(), get_available_locations(), and all EpiModel methods.
  • validate_population_name() error message now includes naming convention guidance and points users to get_available_locations().
  • Optimized compute_spontaneous_transition_rate() and compute_mediated_transition_rate() in epimodel.py to avoid unnecessary deepcopy on the hot simulation path.

Quick start

from epydemix.population import get_available_locations, load_epydemix_population

# Browse all 3,600+ geographies
get_available_locations()                  # all levels
get_available_locations(level=0)           # countries only
get_available_locations(level=1)           # states / provinces
get_available_locations(level=2)           # US counties

# Load a US county
pop = load_epydemix_population("United_States__New_York__New_York_County")

Full changelog: https://github.com/epistorm/epydemix/blob/main/CHANGELOG.md

Release 1.1.0

Choose a tag to compare

@ngozzi ngozzi released this 24 Feb 20:51
3d75db9

What's Changed

  • Migrate lint/format to Ruff, add CONTRIBUTING.md by @Giuzzilla in #5
  • Add ignore_nan parameter to handle NaN values in quantile computations by @mu373 in #6
  • Add variables parameter to trajectory and quantile methods for memory efficiency by @mu373 in #7
  • Add per-simulation time/budget checks to ABC-SMC by @mu373 in #9
  • Bug fix: Skip non-numeric arrays in quantile computation by @mu373 in #10
  • Fix inconsistent data_version default documentation across docstrings and CHANGELOG by @Copilot in #13
  • New pop structure by @ngozzi in #12
  • Version 1.1.0 by @mu373 in #11

New Contributors

  • @Giuzzilla made their first contribution in #5
  • @Copilot made their first contribution in #13

Full Changelog: v.1.02...v1.1.0

v.1.02

Choose a tag to compare

@ngozzi ngozzi released this 30 Oct 13:44

[1.0.2] – 2025-10-30

Added

  • Custom multinomial sampling implementation: replaces numpy.random.multinomial() to improve the calculation of transition probabilities.

    • Transition rate functions now return rates instead of risks, as the conversion is automatically handled during multinomial sampling.
    • Users can enable linear approximation to the probabilities using the apply_linear_approximation argument in simulate() and EpiModel.run_simulations().
  • Support for reproducible random generation: both simulate() and EpiModel.run_simulations() now include an rng argument accepting a numpy.random.Generator object.

    • By default, it is set to None, in which case numpy.random.default_rng() is used.
    • Users can supply a custom generator to ensure reproducibility.
  • Expanded simulate() arguments to optimize the execution time of EpiModel.run_simulations().

  • ABCSampler.run_projections() improvement: now incorporates ABC weights when sampling parameter sets from the approximate posterior distribution.

  • Improved epydemix.visualization.plot_quantiles(): added the data_date_column argument (default: "date") to allow users to specify the name of the date column in the provided data frame.

  • Added a new utils function to create initial conditions dictionary (utils.get_initial_conditions_dict).

Changed

  • Internal handling of transition rate functions adjusted to reflect the new multinomial sampling mechanism (e.g., compute_mediated_transition_rate() and compute_spontaneous_transition_rate()). Advanced users defining custom transition types should review their rate functions accordingly.

Tutorials

  • Added three new tutorials:

    • Modeling of multiple pathogen strains using a two-virus SIR-like model.
    • Implementation of a realistic vaccination campaign rollout, including age-specific dose administration and a new transition type for vaccinations.
    • Speeding up simulations and calibration using multiprocess.

Data

  • Updated U.S. national and state population data in the epydemix_data repository using the more recent estimates from the U.S. Census Bureau.

Compatibility

  • These updates do not introduce breaking changes. Existing code written for previous versions remains compatible.

epydemix 1.0.1

Choose a tag to compare

@ngozzi ngozzi released this 08 May 08:04
ed31973
v1.0.1

Release 1.0.1