astheeggeggs / lshmm

code to run Li and Stephens
MIT License
3 stars 3 forks source link

Control when extreme parameter values are passed to tests #51

Closed szhan closed 1 month ago

szhan commented 1 month ago

While doing #43, I ran into a pathological case when there is no normalisation done while running forward-backward algorithm and when both the mutation rate and recombination rate are very low (1e-6). It led to comparisons of extremely low log-likelihood values (nearly 1e-15), which failed a relative difference test.

To work around this problem, I refactored how combinations of input data and parameters are generated and fed to the tests. First, I added an extra parameter include_extreme_rates to core.get_examples_pars to specify whether to include extreme parameter values. Second, in the class of tests TestNonTreeForwardBackwardDiploid (where the pathological case occurred), I added an extra parameter normalise to verify to control when to run tests with normalisation. This allows for running tests that include extreme values when normalisation is done.