feat: elapsed_between distribution accessor over a named chain (#274)#295
Open
seabbs-bot wants to merge 1 commit into
Open
feat: elapsed_between distribution accessor over a named chain (#274)#295seabbs-bot wants to merge 1 commit into
seabbs-bot wants to merge 1 commit into
Conversation
Add elapsed_between(chain, from, to) and the origin-to-`to` form elapsed_between(chain, to): the LAW of the elapsed distance between two named events of a Sequential chain, as an ordinary univariate distribution (the convolution of the steps strictly between the two events). This is the distribution-level counterpart to the sample-level difference of two event positions, and deliberately NOT difference: two events on one chain descend from a shared origin, so difference(chain, chain) would double-count the shared leading steps. New accessor in src/composers/event_intervals.jl, built on the public convolved verb and the chain's event_names/observed leaves; it does not touch the convolution-layer internals. The event -> leaf-prefix mapping mirrors (not calls) _event_prefix_delay so the accessor does not couple to convolved_interop.jl. A branching chain, an out-of-order or unknown event pair, an uncertain-leaf chain, or a non-chain operand is rejected with a clear error. Tests use continuous components only. Co-authored-by: Sam Abbott <contact@samabbott.co.uk>
Contributor
Try this Pull Request!Option 1: Julia Package ManagerOpen Julia and type: import Pkg
Pkg.activate(temp=true)
Pkg.add(url="https://github.com/EpiAware/ComposedDistributions.jl", rev="feat/cd-274-elapsed-between")
using ComposedDistributionsOption 2: Local CheckoutIf you have the repo locally: git checkout feat/cd-274-elapsed-between
julia --project=. -e "using Pkg; Pkg.instantiate()" |
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Contributor
|
📖 Documentation preview is ready! View the docs for this PR at: https://EpiAware.github.io/ComposedDistributions.jl/previews/PR295/ This preview will be updated automatically when you push new commits. |
Contributor
Benchmark comparison vs baseMinimum time per call. Buckets are PR time as a % of base, so lower is faster (🟢 faster, ⚪ within 5%, 🔴 slower). Counts of benchmarks per bucket:
Evaluation — 17 benchmarks (by time change)
AD gradients — 28 benchmarks (by time change)
|
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.
Closes #274.
What
elapsed_between(chain, from, to)returns the LAW of the elapsed distance between two named events of aSequentialchain, as an ordinary univariate distribution — the convolution of the steps strictly between the two events.elapsed_between(chain, to)is the origin-to-toform (the convolution of the chain prefix up toto).This is the distribution-level counterpart to the sample-level difference of two event positions, and deliberately not
difference: two events on one chain descend from a shared origin, so their absolute positions are not independent anddifference(chain, chain)would double-count the shared leading steps.elapsed_betweenconvolves only the intervening steps.Where / fences
src/composers/event_intervals.jl, built on the publicconvolvedverb and the chain'sevent_names/observed leaves. It does not editconvolved_interop.jlor anythingdiscretise_pmf-adjacent.convolved's value support — this PR encodes no assumption about it.convolved_interop.jl's_event_prefix_delayrather than calling it, so the accessor does not couple to the gated file. If the two later diverge, that is convolution-layer migration cleanup (Convolved#85).Errors (all clear ArgumentErrors)
Branching chain (events don't line up with delay steps), out-of-order or equal
from/to, an unknown event name, an uncertain-leaf chain (pin first), and a non-chain operand (Parallel/Choose/bare distribution) each error with a message naming the way forward. The cross-branch/data-selected cases the issue flags are covered by theParallel/Chooseguards.Verification
Two new testitems (
test/composers/event_intervals.jl), continuous components only. Full non-AD suite green (1554/1554).This was opened by a bot. Please ping @seabbs for any questions.