fix: fit coalescent prior on final node times#862
Draft
ivan-aksamentov wants to merge 1 commit into
Draft
Conversation
The coalescent/skyline prior was fit once before the optimization loop, on the first, pre-reroot node times, and the in-loop re-estimation was gated by i >= 2. Combined with early convergence, a run could keep the pre-loop prior, so the reported prior disagreed with the output node times (B1) and was fit before the final reroot (N5). Re-fit the prior every optimization round on the current node times, and after the loop and any final marginal pass re-fit once more on the final node times. Expose that fit as TimetreeOutput.coalescent_tc so the reported prior is the maximum-likelihood prior of the tree written out. A pipeline test asserts the reported constant Tc maximizes the output tree's coalescent likelihood.
Member
|
yes, refitting every cycle makes sense. The previous schedule and conditioning was not necessary. We can fit the skyline at every iteration, no longer a need to do constant first and then skyline at the end. |
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.
fix/timetree-coalescent-fit-final-node-times->rustUpdate:
kb/issues/M-timetree-skyline-timing-v0-divergence.md: describe the per-round refit and the final reporting fit
Follow-up to: Feat/exact skyline #856
The coalescent (constant or skyline) prior was estimated once before the optimization loop, on the first, pre-reroot node times, and the in-loop re-estimation was gated by
i >= 2. Combined with early convergence, a run could keep that pre-loop prior for the whole run, so the reported prior disagreed with the node times the run outputs, and it was fit before the final reroot changed those times.This re-fits the prior every optimization round on the current node times, and after the loop and any final marginal pass re-fits once more on the final node times. The fit is exposed as
TimetreeOutput.coalescent_tc[src], so the reported prior is the maximum-likelihood prior of the tree that is written out.Under the Kingman coalescent the constant-$T_c$ log-likelihood$\log \mathcal{L}(T_c) = -M\ln T_c - I/T_c$ is strictly unimodal, so the maximum-likelihood $T_c$ of the final tree is unique. Fitting on the final node times makes the reported prior that maximum, and restores v0's intent of conditioning the final node times on the coalescent prior rather than on a first, least-refined tree.
Work items
TimetreeOutput.coalescent_tc[src]Possible improvements