numpyro
numpyro copied to clipboard
Best practices to use one distribution to define another distribution
I have defined some distributions as child classes of Distribution. They are very closely linked, and one is used in another definition. I made a mistake not testing them. Upon testing, I ran into issues which are below,
- For example, I have used
DoublyTruncatedPowerLawto definePowerLawPrimaryMassRatiolike this. The following test code passes out of the bound values to the distribution. It expectsUserWarningbut the problem is those out-of-the-bound values are used to construct another distribution. When that distribution gets invalid input values it throws aValueError.
https://github.com/pyro-ppl/numpyro/blob/3cde93d0f25490b9b90c1c423816c6cfd9ea23ed/test/test_distributions.py#L2170-L2175
[!NOTE] This list might get new entries.