Lea 3.0 final is now released!
Lea is a Python module aiming at working with discrete probability distributions in an intuitive way.
It allows you modeling a broad range of random phenomena: gambling, weather, finance, etc. More generally, Lea may be used for any finite set of discrete values having known probability: numbers, booleans, date/times, symbols, . Each probability distribution is modeled as a plain object, which can be named, displayed, queried or processed to produce new probability distributions.
Lea also provides advanced functions and Probabilistic Programming (PP) features; these include conditional probabilities, Bayesian networks, joint probability distributions, Markov chains and symbolic computation.
Lea can be used for AI, machine learning, education, ...
LGPL - Python 2.6+ / Python 3 supported
Compared to latest version (2.3.5), many things have changed to extend the usability and openness of the library. To name a few:
Here is a short sample. A biased coins is flipped with 1/4 chance to be 'head'. Suppose that this coin is thrown 6 times. What is the probability to get no more than two 'heads'? Here is how you could make this calculation in Lea, using successively float, fraction and symbolic representations:
print (P(lea.binom(6,1/4) <= 2))
# -> 0.83056640625
print (P(lea.binom(6,'1/4') <= 2))
# -> 1701/2048
print (P(lea.binom(6,'p') <= 2))
# -> (p - 1)4(10p2 + 4*p + 1))
print (P(lea.binom(6,'p') <= 2).subs('p',1/4))
# -> 0.830566406250000
Lea 3 on PyPI -> http://pypi.org/project/lea/3.0.0 Lea project page -> http://bitbucket.org/piedenis/lea Documentation -> http://bitbucket.org/piedenis/lea/wiki/Home Statues algorithm -> http://arxiv.org/abs/1806.09997
With the hope that Lea can make the Universe less hazardous,