Lea documentation¶
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, joint probability distributions, Bayesian networks, Markov chains and symbolic computation.
All probability calculations in Lea are performed by a new exact algorithm, the Statues algorithm, which is based on variable binding and recursive generators. For problems intractable through exact methods, Lea provides on-demand approximate algorithms, namely MC rejection sampling and likelihood weighting.
Beside the above-cited functions, Lea provides some machine learning functions, including Maximum-Likelihood and Expectation-Maximization algorithms.
Lea can be used for AI, education (probability theory & PP), generation of random samples, etc.
Lea 4 requires Python 3.8+. For earlier Python versions (2.6+), Lea 3 can be used.
Please visit Lea home page for tutorials and resources.
Features:
discrete probability distributions - support: any object!
probabilistic arithmetic: arithmetic, comparison, logical operators and functions
probabilistic programming (PP): Bayesian reasoning, CPT, BN, JPD, MC sampling, Markov chains, …
machine learning: maximum likelihood & EM algorithms
standard indicators + information theory
multiple probability representations: float, decimal, fraction, …
symbolic computation, i.e. producing probability formulas instead of numbers, using the SymPy library
exact probabilistic inference based on Python generators
random sampling
comprehensive tutorials (Wiki)
Python 3.8+ supported (for Python 2.6+, use Lea 3)
open-source - LGPL license
lea module¶
- lea module
AleaBleaCleaDleaEvidenceCtxFleaFlea1Flea2Flea2aGleaIleaLeaLeaErrorOleaP()Pf()PleaRleaSleaTleaadd_evidence()all_decreasing()all_different()all_equal()all_false()all_increasing()all_pairwise_verify()all_strict_decreasing()all_strict_increasing()all_true()all_verify()any_false()any_true()any_verify()bernoulli()binom()clear_evidence()coerce()cpt()declare_namespace()dist_l1()dist_l2()event()evidencefunc_wrapper()get_active_conditions()get_prob_type()has_evidence()if_()interval()joint()joint_entropy()max_of()min_of()mutual_information()pmf()poisson()pop_evidence()read_bif_file()read_csv_file()read_pandas_df()reduce_all()set_display_options()set_prob_type()vals()- lea.leaf submodule
- lea.markov submodule