Conversation
Smooths over every bipartition of a clade rather than only those in the CCD graph, with the pseudocount set by how many novel clades the bipartition introduces: a per-split alpha on the CCD0 split set (classes 0 and 1 pooled), and class totals alpha1, alpha2 for the one- and two-novel-clade classes. The exponentially large class is obtained by subtraction from 2^(m-1)-1, so it is never enumerated and there is no #P-hard counting. Per-class totals rather than per-split constants are essential: with a constant pseudocount the two-novel class swamps the data, leaving observed splits 6e-9 of the probability at a 40-taxon root clade. Properties, all by construction: exactly normalised by the chain rule (no partition function, no truncation); full support; regCCD nested exactly at alpha1 = alpha2 = 0; an observed split always outranks an expanded one at the same clade; and the mass held back shrinks as f(C) grows. Implements scoring, exact sampling, MAP and entropy. Sampling draws a class then a member, using rejection for the two-novel class, and scores each draw with the same routine the scorer uses, so the sampled and scored distributions coincide. MAP runs a DP over the observed-clade DAG with an optional wider search admitting one-novel-clade splits, plus a bound that can certify global optimality. Entropy is unbiased by Monte Carlo; a deterministic recursion is also provided, which approximates novel subclades as structureless and is therefore optimistic. Verified in CRegCCDTest and CRegCCDMapEntropyTest: total mass 1.000000000000 by enumeration on 4-7 taxa; agreement with RegCCD to 1.8e-15 at alpha1 = alpha2 = 0; class sizes partitioning all 2^(m-1)-1 bipartitions; sampled frequencies matching scored probabilities across all 105 five-taxon topologies; and the MAP search matching brute force in twelve configurations with the certificate firing in each. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… real data KRegNormalisationTest enumerates every rooted topology and asserts that KRegCCD is exactly normalised on four taxa but sub-normalised beyond it, with the deficit scaling as mu^2 and never exceeding one. This is the Theta(mu^2) maximality deficit, which is distinct from, and larger than, the O(mu^(k+1)) reserve truncation. SplitClassSizeAnalysis reports the four split-class sizes at a root clade, showing that a constant per-split pseudocount leaves the observed splits 6.3e-9 of the probability by 40 taxa. ClassUsageAnalysis attributes a held-out tree's log probability to the split classes and measures how much observed structure a two-novel-clade split destroys. RealDataHeadToHeadTest compares CCD1, regCCD, KRegCCD, MRegCCD and CRegCCD on a real posterior using the manuscript's RSV2 protocol, selecting each model's hyperparameters on a validation split disjoint from the fitted set. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Adds
CRegCCD, a full-support CCD that replaces KRegCCD's escape mechanism with additive smoothing over every bipartition of a clade. Paper section is in a PR on the manuscript repo (yangsoph/CCD_regularisation#10).The model
The pseudocount depends only on how many novel clades a bipartition introduces:
alphaper splitalpha1totalalpha2total|A_2|follows by subtraction from2^(m-1)-1, so the exponentially large class is never enumerated. There is no #P-hard counting, no reserve equation and no truncation — the cost is oneO(#clades)scan per clade, comparable to the CCD0 expansion.Per-class totals rather than per-split constants are essential: with a constant pseudocount the two-novel class swamps the data, leaving observed splits
6.3e-9of the probability at a 40-taxon root clade (SplitClassSizeAnalysis).Properties hold by construction rather than by correction:
Theta(mu^2)maximality deficit KRegCCD carries cannot arise, because there are no regionsalpha1 = alpha2 = 0f(C)growsWhat is implemented
Scoring, sampling, MAP and entropy.
Sampling draws a class then a member — classes 0 and 1 by enumeration, class 2 by rejection from uniform bipartitions with an enumeration fallback when acceptance would be poor. Each draw is scored with the same routine the scorer uses, so the sampled and scored distributions coincide exactly; there is no sampling-fidelity choice to make.
MAP runs a DP over the observed-clade DAG, with an optional wider search admitting one-novel-clade splits, plus a bound that can certify global optimality.
Entropy is unbiased by Monte Carlo, since sampler and scorer agree. A deterministic recursion is also provided; it approximates novel subclades as structureless and is therefore optimistic, measured at +2.0% to +10.4% on real data, so Monte Carlo is the estimator of record.
Verification
In
CRegCCDTestandCRegCCDMapEntropyTest:1.000000000000by enumeration on 4–7 taxa, for several training sets and arbitrary pseudocountsRegCCDto1.8e-15atalpha1 = alpha2 = 02^(m-1)-1bipartitions on 135 cladesAlso included
Measurement tests used to characterise the models:
KRegNormalisationTest(KRegCCD is exactly normalised on four taxa, sub-normalised beyond, deficit scaling asmu^2and never exceeding one),SplitClassSizeAnalysis,ClassUsageAnalysis, andRealDataHeadToHeadTest, which compares CCD1, regCCD, KRegCCD, MRegCCD and CRegCCD on a real posterior with hyperparameters selected on a disjoint validation split.Known limitations
alpha1andalpha2are class totals, not per-split pseudocounts, so thealphanaming is arguably misleading —mu1/mu2is under consideration and not yet applied.🤖 Generated with Claude Code