tsinfer
tsinfer copied to clipboard
Dynamically set precision values
At the moment we are setting the precision value to a default of 14. In some testing of the precision parameter, I dynamically set the precision to be the smallest negative exponent of the non-zero mismatch or recombination probabilities, plus 3, as below.
nonzero_probs = np.concatenate(
(recombination[recombination > 0], mismatch[mismatch > 0])
)
# TODO Is this a good default? Need to investigate the effects.
if len(nonzero_probs) > 0:
precision = 3 + int(np.ceil(-np.log10(np.min(nonzero_probs))))
else:
precision = 5 # Needs testing
However, this might need testing / revising anyway when Hartigan parsimony is implemented in https://github.com/tskit-dev/tsinfer/issues/374
Good idea - let's get it in for 0.2.1