SampleAncestralRollbacksTriePostprocessor
- class SampleAncestralRollbacksTriePostprocessor[source]
Functor to correct for systematic overestimation of relatedness by sampling a compensatory adjustment to trie topology.
- __init__(seed: int | None = None) None [source]
Initialize functor instance.
Parameters:
- seed: int, default
Controls sampling decisions in the algorithm.
Pass an int for reproducible output across multiple function calls. The default value, 1, ensures reproducible output. Pass None to use existing RNG context directly.
Methods
- __init__(seed: int | None = None) None [source]
Initialize functor instance.
Parameters:
- seed: int, default
Controls sampling decisions in the algorithm.
Pass an int for reproducible output across multiple function calls. The default value, 1, ensures reproducible output. Pass None to use existing RNG context directly.
- __call__(trie: ~hstrat.phylogenetic_inference.tree._impl._TrieInnerNode.TrieInnerNode, p_differentia_collision: float, mutate: bool = False, progress_wrap: ~typing.Callable = <function SampleAncestralRollbacksTriePostprocessor.<lambda>>) TrieInnerNode [source]
Compensate for bias towards overestimating relatedness due to spurious differentia collisions.
Each rollback operation alters the tree as if a single spurious collision had occured; a single branch is adjusted to exhibit the next- most-ancient last commonality.
The number of rollback operations is calculated from the number of possible spurious collisions and the probability of spurious collision. Unzip targets are sampled randomly using the standard library random module.
Parameters:
- trieTrieInnerNode
The root node of the trie to be unzipped.
- p_differentia_collisionfloat
The multiplicative inverse of the number of possible differentia.
This fraction of possible rollbacks are performed.
- mutatebool, default False
Are side effects on the input argument trie allowed?
- progress_wraptyping.Callable, optional
Pass tqdm or equivalent to report progress.
Returns
- TrieInnerNode
The postprocessed trie.
Notes:
This function assumes underlying shared genesis, so the root node of the trie is not eligible for rollback.