5 ms·
Lea – Discrete probability distributions in Python
- johnloeber 12y agoOh, that looks nice. This is really great. I worked on a project a while back in which I needed to generate a discrete probability distribution, and found Python's support for this to be lacking. I ended up having to hard-code most of the distribution and then use multipliers to cover other cases, which I found very mathematically unsatisfying. Thus, I think Lea looks very helpful for certain use-cases related to discrete probability. Great!
- aligajani 12y agoDid you try Scipy ?
- rawnlq 12y agoI was hoping to see an implementation the alias method [1] for sampling from discrete distributions! Nonetheless very cool. [1] http://en.wikipedia.org/wiki/Alias_method http://en.wikipedia.org/wiki/Alias_method or http://www.keithschwarz.com/darts-dice-coins/ http://www.keithschwarz.com/darts-dice-coins/
- gamegoblin 12y agoA minor grumble, but the filenames are not intuitive at all to me... It makes finding what I'm looking for a bit difficult. alea.py clea.py dlea.py flea.py ilea.py lea.py olea.py plea.py tlea.py Also if anyone is interested in floating point weights, look at the alias method. Good tutorial here: http://www.keithschwarz.com/darts-dice-coins/ http://www.keithschwarz.com/darts-dice-coins/ EDIT: User rawnlq beat me to mentioning the alias method. I second the recommendation.
- sinwave 12y agoI'm under way on something like this for JavaScript with a buddy of mine. https://github.com/jacobmenick/sampling/ https://github.com/jacobmenick/sampling/
- mathgenius 12y agoThe great thing about python is that we all get to implement such a library ourselves, using our own idioms and lack of documentation and/or unit tests.
- d0mine 12y agoI doubt that there are no existing libraries in Python that allow to work with discrete probability distributions. Not that it stops anyone from implementing their own.