7 comments

[ 4.8 ms ] story [ 34.6 ms ] thread
Oh, 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!

A 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/

EDIT: User rawnlq beat me to mentioning the alias method. I second the recommendation.

The 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.
I 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.