Skip to content

Support prior immunity in daily-count simulation - #1270

Merged
sbfnk merged 4 commits into
mainfrom
issue-1269-reduce-count-level-simulation-to-the-dai
Nov 27, 2026
Merged

sbfnk merged 4 commits into
mainfrom
issue-1269-reduce-count-level-simulation-to-the-dai

Conversation

@sbfnk-bot

Copy link
Copy Markdown
Collaborator

Daily-count simulation now subtracts immune people and initial cases from each group’s susceptible pool using count_rule and the existing depletion path.

Count simulation, immunity and quality checks passed 3,492 assertions, though static analysis emitted file-monitor errors. The immunity tests passed six assertions separately; the engine-group check is still running.

Still to do on the issue: Make count continuation state compact, remove the generation-level simulation and its multiplier, and move the mean-field, linear-noise and hybrid approximations with their documentation and tests into a satellite package.

This PR partly addresses #1269.

sbfnk-bot and others added 4 commits November 27, 2026 10:49
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark comparison vs base

Minimum time per call. Buckets are PR time as a % of base, so lower is faster (🟢 faster, ⚪ within 5%, 🔴 slower). Counts of benchmarks per bucket:

Group 🟢 <50% 🟢 50–75% 🟢 75–95% ⚪ 95–105% 🔴 105–125% 🔴 125–150% 🔴 >150%
Evaluation · · · 19 · · ·
Evaluation — 19 benchmarks (by time change)
Benchmark base PR time memory
simulation: homogeneous, susceptibility trait 37.35 ms 38.55 ms ⚪ 1.03× ⚪ 1.0×
simulation: network, live kernel with policy 4.36 ms 4.24 ms ⚪ 0.97× ⚪ 1.0×
simulation: homogeneous SI, max_time 22.78 ms 23.23 ms ⚪ 1.02× ⚪ 1.0×
simulation: homogeneous 30.96 ms 31.43 ms ⚪ 1.02× ⚪ 1.0×
simulation: branching process, HeldCapacity with DeferRefused 1.36 s 1.38 s ⚪ 1.02× ⚪ 1.0×
simulation: network, live kernel 4.04 ms 4.1 ms ⚪ 1.01× ⚪ 1.0×
evaluation: compile_contact_pairs 27.87 μs 27.53 μs ⚪ 0.99× ⚪ 1.0×
simulation: network, shared kernel 171.5 μs 173.12 μs ⚪ 1.01× ⚪ 1.0×
simulation: households 1.07 ms 1.07 ms ⚪ 0.99× ⚪ 1.0×
evaluation: chain size loglikelihood 1.96 μs 1.95 μs ⚪ 0.99× —
simulation: branching process 1.48 ms 1.47 ms ⚪ 1.0× ⚪ 1.0×
evaluation: pairwise_surv_loglik 24.36 μs 24.26 μs ⚪ 1.0× ⚪ 1.0×
evaluation: PoissonLognormal pdf 36.68 μs 36.75 μs ⚪ 1.0× ⚪ 1.0×
simulation: branching process, interventions 16.72 μs 16.69 μs ⚪ 1.0× ⚪ 1.0×
evaluation: PoissonLognormal pdf, large count 37.99 μs 38.03 μs ⚪ 1.0× ⚪ 1.0×
evaluation: PoissonWeibull pdf, large count 50.56 μs 50.52 μs ⚪ 1.0× ⚪ 1.0×
evaluation: PoissonWeibull pdf 51.62 μs 51.6 μs ⚪ 1.0× ⚪ 1.0×
evaluation: ChainSizes loglikelihood 460.0 ns 460.0 ns ⚪ 1.0× —
evaluation: extinction_probability 891.0 ns 891.0 ns ⚪ 1.0× ⚪ 1.0×
AD gradients — 0 benchmarks (by time change)

none

@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.80%. Comparing base (9690136) to head (e05686b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1270   +/-   ##
=======================================
  Coverage   97.80%   97.80%           
=======================================
  Files         104      104           
  Lines       11904    11906    +2     
=======================================
+ Hits        11643    11645    +2     
  Misses        261      261           
Flag Coverage Δ
epibranch-ad 29.21% <0.00%> (-0.01%) ⬇️
epibranch-analytical 40.22% <0.00%> (-0.03%) ⬇️
epibranch-engine 52.17% <100.00%> (-0.01%) ⬇️
epibranch-inference 43.98% <0.00%> (-0.02%) ⬇️
epibranch-interventions 54.42% <50.00%> (-0.02%) ⬇️
epibranch-population 53.93% <0.00%> (-0.02%) ⬇️
epihouseholds 96.94% <ø> (ø)
epinetwork 95.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbfnk-bot
sbfnk-bot marked this pull request as ready for review November 27, 2026 12:22
@sbfnk-bot
sbfnk-bot requested a review from sbfnk as a code owner November 27, 2026 12:22
@sbfnk
sbfnk merged commit 301e2c0 into main Nov 27, 2026
29 checks passed
@sbfnk
sbfnk deleted the issue-1269-reduce-count-level-simulation-to-the-dai branch November 27, 2026 13:29
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.

2 participants