Tree Metric¶
The normalized branch-score metric: d^2 = (1-w) CBS^2/C_ref + w RF/R_ref,
combining the clade branch score with the Robinson-Foulds count. The chart owns
a metric instance built from its anchor set.
CBSMetric
dataclass
¶
Normalized branch-score implementation of the TreeMetric protocol.
distance = d = sqrt((1 - w) * CBS^2 / c_ref + w * RF / r_ref): the
Kuhner-Felsenstein (1994) clade branch score combined with the Robinson-Foulds
topological distance, weighted by w in [0, 1] (0 = pure branch score,
1 = pure topology). c_ref and r_ref normalize the two terms; the
defaults 1.0 give the raw branch score at w = 0. Use :meth:for_anchors
to derive the normalizers from an anchor set.
quality = B_frac in [0, 1]; the length-overlap fraction. Near 0 = branch-
score saturation; near 1 = similar trees.
kuhner1994branch, robinson1981rf.
Source code in src/hifuku/metric/branch_score.py
|
for_anchors
classmethod
¶
Build a metric whose normalizers are the mean CBS^2 and mean RF over the anchor set.
w then means the same across datasets, and every chart built on these
anchors shares one metric, so the charts stitch into one common frame.
The anchors must have global_leaf_indices set.
Source code in src/hifuku/metric/branch_score.py
compute_normalizers
¶
Metric normalization scales from an anchor set: (C_ref, R_ref).
C_ref is the mean raw CBS^2 over all anchor pairs; R_ref is the mean
RF over all anchor pairs, floored at 1. Computed over the whole anchor set,
not one triplet, so every chart built on these anchors uses the same metric
and the charts stitch into one frame. The anchors must have
global_leaf_indices set. taxon_table is accepted for interface
symmetry; the anchors are expected to already share a namespace.