ANN: Lea 3.0.0 beta 2

Pierre Denis pie.denis at
Sun May 27 11:22:29 EDT 2018

Lea 3.0.0.beta.2 is now released!


What is Lea?
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

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, ...

What's new in Lea 3?
Compared to latest version (2.3.5), many things have changed to extend the
usability and openness of the library. To name a few:

* ability to choose between different probability representations: floats,
fractions and decimals
* symbolic computation: Lea can now calculate probability *formula* using
the SymPy library (
* simpler API and compliance with PEP8 naming convention
* revamped tutorials and examples ->

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*(10*p**2 + 4*p + 1))
  print (P(lea.binom(6,'p') <= 2).subs('p',1/4))
  # -> 0.830566406250000

To learn more...
Lea project page ->
Documentation    ->
Lea 3 on PyPI    ->

With the hope that Lea can make the Universe less uncertain,

Pierre Denis

More information about the Python-announce-list mailing list