feat: covariate-requirement introspection (#266)#293
Open
seabbs-bot wants to merge 1 commit into
Open
Conversation
Contributor
|
📖 Documentation preview is ready! View the docs for this PR at: https://EpiAware.github.io/ComposedDistributions.jl/previews/PR293/ This preview will be updated automatically when you push new commits. |
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Adds required_covariates(tree), listing the covariate names a tree's Varying leaves and data-selected Choose disjunctions will read, keyed to the node paths that read them; required_parameters(tree), the symmetric sibling over unpinned (estimated) parameters read off params_table; and missing_covariates(tree, ctx), checking a Context against the former so a caller can validate a data source's columns up front instead of discovering a gap reactively, one covariate at a time, mid-instantiate. Lives in varying.jl alongside the existing has_varying guard (introspection.jl loads before Varying/Shared/Choose exist, so the walk needs their types already defined). 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/covariate-requirements-266")
using ComposedDistributionsOption 2: Local CheckoutIf you have the repo locally: git checkout feat/covariate-requirements-266
julia --project=. -e "using Pkg; Pkg.instantiate()" |
3 tasks
seabbs-bot
force-pushed
the
feat/covariate-requirements-266
branch
from
July 21, 2026 11:15
62fc286 to
c010758
Compare
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.
Summary
required_covariates(tree)lists the covariate names a tree'sVaryingleaves and data-selectedChoosedisjunctionswill read, keyed to the node paths that read them (
Dict{Symbol, Vector{Symbol}}), so a caller can validate a data source's columns upfront instead of discovering a gap reactively, one covariate at a time,
mid-
instantiate.required_parameters(tree)is the symmetric sibling: the unpinned(estimated) parameters a tree's
params_tablestill needs, as(edge, param)pairs (every row whoseprioris notnothing).missing_covariates(tree, ctx)checks aContextagainstrequired_covariates, returning the (possibly empty) vector of names thecontext is missing, reporting every gap at once rather than the first one
instantiatehappens to reach.Choose's ownselectorrequirement is labelled with a:selectorsuffix (mirroring how
params_tablelabels aResolve's ownbranch_probsrow), so a root-levelChoosereports a real edge nameinstead of an empty path.
varying.jlalongside the existinghas_varyingguard:introspection.jlloads beforeVarying/Shared/Chooseexist, so thenew tree walk (which needs those types for its per-node dispatch) can't
live there without a forward-reference load error.
Closes #266.
Test plan
@testitem "required_covariates / required_parameters / missing_covariates (#266)": a stationary tree (empty), a singleVaryingleaf, two leaves sharing one covariate name, aVaryingnested inside a
Resolveoutcome, a root-level and nestedChooseselector requirement (plus a
Choosealternative that itselfcontains a
Varyingleaf), and anuncertainleaf's estimatedparameter.
task test-fast— 1543/1543 passed.This was opened by a bot. Please ping @seabbs for any questions.