rethinkpriorities / squigglepy

Squiggle programming language for intuitive probabilistic estimation features in Python
MIT License
65 stars 8 forks source link

Fix pareto_sample to sample from Pareto dist instead of Lomax #60

Closed michaeldickens closed 11 months ago

michaeldickens commented 11 months ago

numpy.random.pareto actually samples from a Lomax distribution for some ungodly reason (see docs). I could see a couple ways to handle this in Squigglepy:

  1. When sampling, convert the Lomax to a Pareto
  2. Keep using Lomax, and explain in the docstrings for ParetoDistribution/sample_pareto that it's actually Lomax (maybe also change the names)

I went with the first fix because a Pareto distribution works better for an upcoming PR I am writing for Squigglepy (which is much more fun than this one). IMO a Lomax distribution makes more sense for most real-world purposes but it's harder to work with mathematically and it's not used as often.