Skip to content

fix: reject over-segmented skyline grids#865

Closed
ivan-aksamentov wants to merge 1 commit into
rustfrom
fix/coalescent-skyline-grid-validation
Closed

fix: reject over-segmented skyline grids#865
ivan-aksamentov wants to merge 1 commit into
rustfrom
fix/coalescent-skyline-grid-validation

Conversation

@ivan-aksamentov

Copy link
Copy Markdown
Member

fix/coalescent-skyline-grid-validation -> rust

Update:

The merger-quantile boundary construction clamps interior candidates to be non-decreasing, so requesting more segments than the tree has distinct merger times produced duplicate (zero-width) or zero-exposure segments. A segment with a merger but no exposure has $M_i > 0$ and $I_i = 0$, for which the objective $I_i x - M_i \ln x$ is unbounded below; the solver masked this with a pooled warm-start fallback, so its $T_c$ was set by the smoothing prior rather than the genealogy, with no diagnostic. The recorded guarantee that every segment owns a merger held only when the requested segment count did not exceed the distinct merger times.

This rejects an over-segmented grid up front, when the requested segments exceed the distinct merger times, and validates strictly increasing boundaries and positive per-segment exposure as backstops, each with an actionable error [src]. The skyline tests move to a tree with enough lineage-count resolution for multiple segments, assert the segment-count and ordering invariants, and cover both the over-segmentation and zero-exposure errors.

Erroring is correct because a segmentation the data cannot support has no meaningful maximum-likelihood solution: the affected segment's $T_c$ is fixed by the prior, not the data. Silently capping the segment count would change the reported model without the user's knowledge, whereas a clear error lets the user choose a supported --n-skyline.

Work items

  • Reject requested segments exceeding the number of distinct merger times [src]
  • Validate strictly increasing boundaries and positive per-segment exposure [src]
  • Rework the skyline tests to valid segment counts, asserting the invariant and both error paths [src]

Possible improvements

The merger-quantile boundary construction clamps interior candidates to be non-decreasing, so requesting more segments than the tree has distinct merger times produced duplicate (zero-width) or zero-exposure segments. For those the objective I_i x - M_i ln x is unbounded below, and the solver masked it with a pooled warm-start fallback, so a per-segment Tc was set by the smoothing prior rather than the data, without a diagnostic.

optimize_skyline now rejects an over-segmented grid up front (requested segments exceeding distinct merger times) and validates strictly increasing boundaries and positive per-segment exposure as backstops, erroring with an actionable message. The skyline tests use valid segment counts, assert the strictly-increasing invariant and the segment-count bound, and cover the over-segmentation error.
@rneher

rneher commented Jul 23, 2026

Copy link
Copy Markdown
Member

let's hold off on that one. I was going to look into the regularization a bit more.

@ivan-aksamentov
ivan-aksamentov deleted the fix/coalescent-skyline-grid-validation branch July 24, 2026 15:25
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