Skip to content

fix(Split): let a weight map name the streams of a simulation - #391

Open
seabbs-bot wants to merge 2 commits into
mainfrom
claude/prs-issues-triage-p548ev-split-missing
Open

seabbs-bot wants to merge 2 commits into
mainfrom
claude/prs-issues-triage-p548ev-split-missing

Conversation

@seabbs-bot

Copy link
Copy Markdown
Collaborator

Closes #365

A strata Split with a weight map fixes its stream count as the map's row count, so the shape resolution builds the right infection process for y_t = missing.
The model then failed inside Split, because _split_names reads the stream names off the data and a scalar missing names nothing.
The workaround was a matrix of missings of the right row count, which carries the shape in a placeholder rather than on the model.

_split_names now falls back to group1, group2 and so on for size(map, 1) streams when the data names none, which is what a data matrix with that many rows gives.
A strata template with no map still has nothing to name its streams by and still errors.

Tests

One item covers the bare Split simulating from missing with the map, the same through an IDModel over three infection strata projected onto one stream, and the template-without-map error staying put.
The split, strata composition and inference items pass locally, 124 of 124.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lw3PbYZfA1dZhfaaE9tbdp


Generated by Claude Code

A strata Split with a weight map fixes its stream count as the map's
row count, but with no data it still asked the data to name its
streams and refused a scalar missing. It now names them group1, group2
and so on, the way a data matrix with that many rows would, so a mapped
Split simulates the way every other observation model does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lw3PbYZfA1dZhfaaE9tbdp
@seabbs-bot
seabbs-bot requested a review from seabbs as a code owner September 5, 2026 21:50
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Try this Pull Request!

Option 1: Julia Package Manager

Open Julia and type:

import Pkg
Pkg.activate(temp=true)
Pkg.add(url="https://github.com/EpiAware/ComposableTuringIDModels.jl", rev="claude/prs-issues-triage-p548ev-split-missing")
using ComposableTuringIDModels

Option 2: Local Checkout

If you have the repo locally:

git checkout claude/prs-issues-triage-p548ev-split-missing
julia --project=. -e "using Pkg; Pkg.instantiate()"

@github-actions

github-actions Bot commented Sep 6, 2026 •

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 · · · 9 · · ·
ForwardDiff · 1 · 1 · · ·
ReverseDiff (tape) · · 1 1 · · ·
Mooncake reverse · · · 2 · · ·
Enzyme reverse · · · · 1 · ·
Evaluation — 9 benchmarks (by time change)
Benchmark base PR time memory
Model evaluation / RandomWalk latent / rand 471.0 ns 450.0 ns ⚪ 0.96× ⚪ 1.0×
Sampling / NUTS (DirectInfections+Poisson, 50 draws) 90.73 ms 93.42 ms ⚪ 1.03× ⚪ 1.0×
Model evaluation / DirectInfections+Poisson / rand 691.0 ns 671.0 ns ⚪ 0.97× ⚪ 1.0×
Model evaluation / RandomWalk latent / forward 431.0 ns 421.0 ns ⚪ 0.98× ⚪ 1.0×
Model evaluation / AR latent / forward 541.0 ns 550.0 ns ⚪ 1.02× ⚪ 1.0×
Model evaluation / AR latent / rand 641.0 ns 651.0 ns ⚪ 1.02× ⚪ 1.0×
Model evaluation / DirectInfections+Poisson / forward 1.12 μs 1.11 μs ⚪ 0.99× ⚪ 1.0×
Model evaluation / Renewal+NegativeBinomial / rand 2.2 μs 2.21 μs ⚪ 1.0× ⚪ 1.0×
Model evaluation / Renewal+NegativeBinomial / forward 4.72 μs 4.72 μs ⚪ 1.0× ⚪ 1.0×
AD gradients — 7 benchmarks (by time change)
Benchmark base PR time memory
AD gradients / AR latent logjoint / ForwardDiff 8.22 μs 5.79 μs 🟢 0.7× ⚪ 1.0×
AD gradients / AR latent logjoint / ReverseDiff (tape) 107.51 μs 95.48 μs 🟢 0.89× ⚪ 1.0×
AD gradients / DirectInfections+Poisson posterior / Enzyme reverse 3.43 μs 3.71 μs 🔴 1.08× ⚪ 1.0×
AD gradients / DirectInfections+Poisson posterior / ForwardDiff 14.08 μs 13.78 μs ⚪ 0.98× ⚪ 1.0×
AD gradients / DirectInfections+Poisson posterior / Mooncake reverse 8.59 μs 8.75 μs ⚪ 1.02× ⚪ 1.0×
AD gradients / DirectInfections+Poisson posterior / ReverseDiff (tape) 103.76 μs 104.95 μs ⚪ 1.01× ⚪ 1.0×
AD gradients / AR latent logjoint / Mooncake reverse 5.41 μs 5.4 μs ⚪ 1.0× ⚪ 1.0×

The rebuild-coverage test item added in #372 does
`using InteractiveUtils: subtypes`, but the stdlib was never added to
`test/Project.toml`. Julia 1.12 refuses to load a stdlib that is not in
the active environment, so every test matrix job on a branch carrying
that item errors in `reconstruction.jl`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lw3PbYZfA1dZhfaaE9tbdp
(cherry picked from commit 4d7322a)

Copy link
Copy Markdown
Collaborator Author

CI status on 850578d.

Every test job that has finished is green, and the docs build is running.
downgrade-compat / Downgrade Compat was cancelled at the reusable workflow's hard-coded 45-minute job cap (downgrade.yml in EpiAware/.github at the pinned ref, no timeout_minutes input), after 45 minutes on the julia-runtest step under tonight's runner load.
The cap is filed as EpiAware/EpiAwarePackageTools.jl#521.
I will re-run the job once when the rest of the Test run has finished, since GitHub will not re-run a single job of a run still in progress.


Generated by Claude Code

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

📖 Documentation preview is ready!

View the docs for this PR at: https://EpiAware.github.io/ComposableTuringIDModels.jl/previews/PR391/

This preview will be updated automatically when you push new commits.

@codecov

codecov Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
ad-enzyme-forward 63.28% <0.00%> (-0.04%) ⬇️
ad-enzyme-reverse 62.08% <0.00%> (-0.04%) ⬇️
ad-forwarddiff 62.50% <0.00%> (-0.04%) ⬇️
ad-mooncake-forward 62.50% <0.00%> (-0.04%) ⬇️
ad-mooncake-reverse 62.50% <0.00%> (-0.04%) ⬇️
ad-reversediff 62.70% <0.00%> (-0.04%) ⬇️
ad-reversediff-compiled 62.70% <0.00%> (-0.04%) ⬇️
unit 94.02% <100.00%> (+0.15%) ⬆️

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

Files with missing lines Coverage Δ
src/observation_models/Split.jl 100.00% <100.00%> (+1.63%) ⬆️

... and 6 files with indirect coverage changes

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

Copy link
Copy Markdown
Collaborator Author

Update on 850578d.

Every test matrix job and all seven AD jobs are green, and the docs build succeeded.
coverage / coverage was cancelled a second time at the 45-minute cap (attempt 2, on the julia-runtest step), so I am not re-running it again.
The cap itself is EpiAware/EpiAwarePackageTools.jl#521.

That leaves codecov/patch red, and only for that reason: the one changed line in Split.jl is exercised by the Split simulates with a weight map and no data test item in the unit suite, and the unit flag is the upload the cancelled coverage job would have made.
The AD jobs upload their own flags, and none of them runs that item, so Codecov sees the line as unhit.
Once the cap is lifted upstream, or on the next push here, the coverage job will report it.

downgrade-compat / Downgrade Compat has had its one re-run and is running now.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

Correction to the comment above: the test item that exercises the changed line is a strata Split with a weight map simulates with no data, in test/unit/observation_models/split.jl.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

Further to the above: the cancelled coverage attempt had already uploaded its unit report before the cap hit, so Codecov now shows Split.jl at 100% and both codecov/patch and codecov/project are green.
The only check still running on 850578d is the downgrade re-run.


Generated by Claude Code

seabbs-review-bot[bot]

This comment was marked as resolved.

@seabbs-review-bot seabbs-review-bot Bot added the llm-reviewed Reviewed by seabbs-review-bot label Sep 8, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-reviewed Reviewed by seabbs-review-bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A strata Split with a weight map cannot simulate from missing data

2 participants