Skip to content

[3/5] Family moves in every Sampler set - #143

Open
m-murphy wants to merge 8 commits into
stack/2-samplersfrom
stack/3-family-moves
Open

m-murphy wants to merge 8 commits into
stack/2-samplersfrom
stack/3-family-moves

Conversation

@m-murphy

@m-murphy m-murphy commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Family moves join every Sampler set except the null model's, which has no transmission. A family is a close mutual pair, or a connected triple of close pairs. A pair is close when at most 3 loci have an allele observed in one infection and not the other, counted in the direction where that count is smaller. Loci missing in either infection don't count.

 Sampler set
   … every sampler before
   GuidedPairSampler/pairs
+  GuidedGroupSampler/families      # 5 relocations per iteration: two members to new infection times,
+                                   # genotypes from a pilot over parents inside the family, exact reverse check
+  PairLocusGibbsSampler/families   # 20 Proposals per iteration: a pair's genotypes at one Locus redrawn together

No option: like every other sampler, they're always on outside the null model. The counts are FAMILY_RELOCATIONS and FAMILY_PAIR_LOCUS_PROPOSALS in config.h, the one source of the family moves' settings. Both samplers use one closeness test (Family.h), and the three guided samplers share one log-weighted draw. CONTEXT.md gains Family and Family move.

Evidence

  • Before / after, six simulated studies × 4 chains, 3000 iterations, sampled log-uniform leak, mean over studies:

    R-hat chain spread edges with chains > 0.5 apart edge AP top-1 wall time
    without family moves 1.05 11.7 2.4 0.658 0.502 56.6 h
    with family moves 1.03 6.2 1.1 0.666 0.506 65.8 h

    Chain disagreement roughly halves, for about 16% more time. In an earlier run, 50 relocations and 200 pair-locus Proposals cost about twice as much as 5 and 20, with no gain.

  • FamilyMovesTest checks both moves leave their target invariant against exact draws, for a pair and for a relocation of a triple. A third test checks that missing loci don't count toward closeness. Engine tests: 316 pass, 1 skipped. plasmotrackr tests: 3724 pass.

  • The example input has no families, so the golden Stores keep every draw. They gain only the two samplers' rows in structure/samplers and in acceptance.

Merge Danger

Door: two-way

Blast Radius: Runs

  • Inputs with families give different draws for a seed and run about 16% longer.
  • A checkpoint from an older build is refused (different sampler list).

GuidedGroupSampler moves two members of a family of closely related infections to new infection times; a
deterministic pilot makes the family's genotypes consistent with its best internal transmission tree, and a walk
redraws them in proportion to the target. PairLocusGibbsSampler redraws a related pair's genotypes at one locus
together, by a Gibbs step over candidates fixed by the observed data. Each changes what a single-infection move
cannot: an observed allele called a false positive while its relative drops the hidden allele it held for it.

PairLocusGibbsSampler keeps only units that can change something: pairs at most maxNovelty loci apart, loci where
their observed genotypes conflict, and an unobserved member's single-allele candidates from its partner's observed
alleles; a unit with one candidate pair is dropped.

Exact-draws tests check that each leaves its target invariant.
Each iteration makes FAMILY_RELOCATE_STEPS (5) GuidedGroupSampler relocations and FAMILY_PAIR_LOCUS_STEPS (20)
PairLocusGibbsSampler steps, registered after the other samplers. Families are the mutual pairs whose observed genotypes
are at most FAMILY_MAX_NOVELTY loci apart, and their connected triples. An input without families gets the two samplers
too; they make no steps.
The example input has no families, so the two samplers make no steps and the draws a seed gives are unchanged; the
Store gains their rows in structure/samplers and in each acceptance Window. plasmotrackr's acceptance tests count the
two new sampler types.
…roposal; the relocation pilot builds its Proposal in one place
…ations and Proposals for steps, config.h the one source of their settings

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant