Contribute Media
A thank you to everyone who has made this possible: Read More

SymPy Stats - Uncertainty Modeling


SymPy is a symbolic algebra package for Python. In SymPy.Stats we add a stochastic variable type to this package to form a language for uncertainty modeling. This allows engineers and scientists to symbolically declare the uncertainty in their mathematical models and to make probabilistic queries. We provide transformations from probabilistic statements like P(X*Y > 3) or E(X**2) into deterministic integrals. These integrals are then solved using SymPy's integration routines or through numeric sampling.

This talk touches on a few rising themes:

  • The rise in interest in uncertainty quantification and
  • The use of symbolics in scientific computing
  • Intermediate representation layers and multi-stage compilation

Historically solutions to uncertainty quantification problems have been expressed by writing Monte Carlo codes around individual problems. By creating a symbolic uncertainty language we allow the expression of the problem-to-be- solved to be written separately from the numerical technique. SymPy.stats serves as an interface layer. The statistical programmer doesn't need to think about the details of numerical techniques and the computational methods programmer doesn't need to think about the particular domain-specific questions to be solved.

We have implemented multiple comptuational backends including purely symbolic (using SymPy's integration engine), sampling, and code generation.

In the talk we discuss these ideas with a few illustrative examples taken from basic probability and engineering. The following is one such example using-sympy/

Improve this page