Skip to content

Allow isolated non-sample nodes in all dating methods - #531

Open
hyanwong wants to merge 1 commit into
tskit-dev:mainfrom
hyanwong:isolated-nodes
Open

hyanwong wants to merge 1 commit into
tskit-dev:mainfrom
hyanwong:isolated-nodes

Conversation

@hyanwong

@hyanwong hyanwong commented Nov 4, 2026

Copy link
Copy Markdown
Member

Non-sample nodes that are in no edge can't be dated, but previously caused an error (variational_gamma: "disconnected nodes"; inside_outside/maximization: a misleading "not simplified" error).

Now, for all methods:

  • Isolated non-sample nodes keep their input time.
  • Their mn/vr node metadata is NaN, as are their rows in variational_gamma's fit.node_posteriors() (inside_outside already gives NaN for fixed nodes).
  • They no longer influence the dating of other nodes. This needed a fix in rescaling.mutational_area, which built time epochs from all nodes, so an isolated node with a large time distorted the rescaling.
  • Isolated samples still raise an error.

Tests: TestIsolatedNodes in tests/test_inference.py (all three methods, several isolated times; checks other node times are unchanged vs. the tree sequence without the node). Docs and changelog updated. Full suite passes; timing on 500 samples x 10 Mb is unchanged.

Non-sample nodes that are in no edge can't be dated. They now keep their
input time, have NaN posterior mean/variance in node metadata and in
variational_gamma's fit.node_posteriors(), and no longer affect the dating
of other nodes (mutational_area ignores edgeless nodes when building
epochs). Isolated samples still raise an error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nspope

nspope commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Sorry for delay here, I'll get to a review after the 13th

@hyanwong

hyanwong commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

Thanks. I don't think there's anything controversial here, but it would be good to have an extra set of eyes on it.

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.

2 participants