Skip to content

fix(observations): marginalise a gap on the bare path, and draw a blank series everywhere - #392

Open
seabbs-bot wants to merge 3 commits into
mainfrom
claude/prs-issues-triage-p548ev-blank-series
Open

seabbs-bot wants to merge 3 commits into
mainfrom
claude/prs-issues-triage-p548ev-blank-series

Conversation

@seabbs-bot

Copy link
Copy Markdown
Collaborator

Closes #343

Option 1 from the issue, as agreed there.

The two routes disagreed

A gap in a plain vector handed to a bare error model reached DynamicPPL's y_t[i] ~ dist sugar and was sampled as a latent.
The same series through a NamedTuple field or an IDModel was narrowed with concrete_observations and the gap marginalised.
Two routes into one error model gave different posteriors for the same data.

What changes

_scored_series narrows the bare path too, so a gap is a MissingObservations carrier on every route, scored by reading only, and the caller's array is never written into.

A series with nothing observed in it is the same request as missing, a predictive draw at that length.
concrete_observations now returns a Vector{Missing} of that length for one, whatever its element type, where it used to build an all-false carrier that marginalised the whole series on the narrowing routes and drew on the bare one.
That is the one behaviour change a caller can see: an IDModel or a NamedTuple field given Vector{Union{Missing, Int}}(missing, n) now simulates the series rather than returning n missings.
A Split on a blank data matrix already drew, so it is unchanged, which is what ruled out the narrower fix recorded on the issue.

Tests

The all-blank case in the concrete_observations item and the blank NamedTuple field case in the observations item now pin the predictive form.
A new item checks the bare vector and the NamedTuple field give the same empty parameter set and the same log-joint for [5, missing, 7], leave the caller's array alone, and draw a blank series at its own length.
The compose, observations, split, inference and requirements items pass locally, 480 of 480.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lw3PbYZfA1dZhfaaE9tbdp


Generated by Claude Code

…nk series everywhere

A gap in a plain vector handed to a bare error model was sampled as a
latent, where the same series through a NamedTuple field or an IDModel
was marginalised. The bare path now narrows its series the same way,
so a blank leaves the likelihood on every route and the caller's array
is never written into.

A series with nothing observed in it was a carrier that marginalised
the whole series on the narrowing routes and a predictive draw on the
bare one. It is the same request as missing, so it now takes the
predictive form at its own length on every route.

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-blank-series")
using ComposableTuringIDModels

Option 2: Local Checkout

If you have the repo locally:

git checkout claude/prs-issues-triage-p548ev-blank-series
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 / DirectInfections+Poisson / rand 652.0 ns 681.0 ns ⚪ 1.04× ⚪ 1.0×
Sampling / NUTS (DirectInfections+Poisson, 50 draws) 94.53 ms 96.88 ms ⚪ 1.02× ⚪ 1.0×
Model evaluation / RandomWalk latent / rand 441.0 ns 450.0 ns ⚪ 1.02× ⚪ 1.0×
Model evaluation / AR latent / forward 530.0 ns 521.0 ns ⚪ 0.98× ⚪ 1.0×
Model evaluation / AR latent / rand 651.0 ns 651.0 ns ⚪ 1.0× ⚪ 1.0×
Model evaluation / DirectInfections+Poisson / forward 1.12 μs 1.12 μs ⚪ 1.0× ⚪ 1.0×
Model evaluation / RandomWalk latent / forward 420.0 ns 420.0 ns ⚪ 1.0× ⚪ 1.0×
Model evaluation / Renewal+NegativeBinomial / forward 4.69 μs 4.69 μs ⚪ 1.0× ⚪ 1.0×
Model evaluation / Renewal+NegativeBinomial / rand 2.2 μs 2.2 μs ⚪ 1.0× ⚪ 1.0×
AD gradients — 7 benchmarks (by time change)
Benchmark base PR time memory
AD gradients / AR latent logjoint / ForwardDiff 8.39 μs 5.77 μs 🟢 0.69× ⚪ 1.0×
AD gradients / AR latent logjoint / ReverseDiff (tape) 137.39 μs 118.4 μs 🟢 0.86× ⚪ 1.0×
AD gradients / DirectInfections+Poisson posterior / ForwardDiff 14.7 μs 13.52 μs 🟢 0.92× ⚪ 1.0×
AD gradients / DirectInfections+Poisson posterior / Enzyme reverse 3.55 μs 3.64 μs ⚪ 1.03× ⚪ 1.0×
AD gradients / DirectInfections+Poisson posterior / Mooncake reverse 8.71 μs 8.53 μs ⚪ 0.98× ⚪ 1.0×
AD gradients / AR latent logjoint / Mooncake reverse 5.36 μs 5.37 μs ⚪ 1.0× ⚪ 1.0×
AD gradients / DirectInfections+Poisson posterior / ReverseDiff (tape) 103.65 μs 103.5 μ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)
@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.34% <100.00%> (+0.02%) ⬆️
ad-enzyme-reverse 62.13% <100.00%> (+0.02%) ⬆️
ad-forwarddiff 62.56% <100.00%> (+0.02%) ⬆️
ad-mooncake-forward 62.56% <100.00%> (+0.02%) ⬆️
ad-mooncake-reverse 62.56% <100.00%> (+0.02%) ⬆️
ad-reversediff 62.75% <100.00%> (+0.02%) ⬆️
ad-reversediff-compiled 62.75% <100.00%> (+0.02%) ⬆️
unit 93.96% <100.00%> (+0.10%) ⬆️

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

Files with missing lines Coverage Δ
src/compose.jl 97.43% <100.00%> (+0.06%) ⬆️
...servation_models/ObservationErrorModels/methods.jl 100.00% <100.00%> (ø)

... 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

CI status on e51bd34.

Every test matrix job, coverage / coverage, all seven AD jobs and both Codecov checks are green.
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 have re-run that job once, now that the rest of the Test run has finished.

Documenter / Documentation was cancelled by the repository-wide docs queue (EpiAware/EpiAwarePackageTools.jl#522) and will be re-run when the queue has room.


Generated by Claude Code

main dropped a cross-reference from the _scored_series comment that this
branch had already rewritten, so the branch's comment and method stand.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lw3PbYZfA1dZhfaaE9tbdp
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

📖 Documentation preview is ready!

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

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

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 gap in a plain vector handed to a bare error model is sampled, not marginalised

3 participants