pyro-ppl / numpyro

Probabilistic programming with NumPy powered by JAX for autograd and JIT compilation to GPU/TPU/CPU.
https://num.pyro.ai
Apache License 2.0
2.09k stars 227 forks source link

Truncated Power Law Distributions #1807

Open Qazalbash opened 1 month ago

Qazalbash commented 1 month ago

This PR contains the implementation of Power Law distributions, that fixes #1806. There are two different types of power law implementations based on their truncation.

  1. DoublyTruncatedPowerLaw
  2. LowerTruncatedPowerLaw

They are named in such way to avoid confusion with TwoSidedTruncated* and LeftTruncated* distributions.

Qazalbash commented 1 month ago

@fehiepsi Power Law is not in SciPy. Can you guide me for the Unit Tests?

fehiepsi commented 4 weeks ago

Hi @Qazalbash, you could add if/else statements to skip some tests (like some other distributions). Do you have reference for this distribution? I couldn't find it on wikipedia.

Qazalbash commented 4 weeks ago

@fehiepsi unfortunately I couldn't find much on internet too. I have seen many papers in astrophysics using these distributions. Therefore, I did the derivations. If you like to see, I can share them. This way we can cross check it too.

fehiepsi commented 2 weeks ago

I think we would need to let users know how to use the distribution. Could you add references / formulas in the docstring? I can double-check the formulas - though I hope that the tests will cover them.