

Lea – Discrete probability distributions in Python - naftaliharris
http://code.google.com/p/lea/

======
gamegoblin
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/](http://www.keithschwarz.com/darts-dice-coins/)

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

------
johnloeber
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!

~~~
aligajani
Did you try Scipy ?

------
rawnlq
I 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/)

------
sinwave
I'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
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.

~~~
d0mine
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.

