Skip to content

Commit

Permalink
PPLs full section
Browse files Browse the repository at this point in the history
  • Loading branch information
elizavetasemenova committed Feb 3, 2024
1 parent e345c36 commit 161b015
Showing 1 changed file with 39 additions and 25 deletions.
64 changes: 39 additions & 25 deletions 07_PPLs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Probabilistic Programming Languages
# Probabilistic Programming

## Probabilistics programming
## What is probabilistics programming

[Probabilistic programming](https://en.wikipedia.org/wiki/Probabilistic_programming) (PP) is a paradigm in computer programming that enables the creation of models and algorithms capable of <font color='green'>handling uncertainty</font> and randomness. It combines principles from probability theory and programming to build systems that can reason about uncertain data and make informed decisions. This approach allows developers to express complex models in a natural and intuitive way, enabling tasks such as Bayesian inference, machine learning, and statistical analysis to be performed more effectively.

Expand Down Expand Up @@ -31,43 +31,57 @@ You can think of the overall logic hierarchy as

Inference &rarr; Probabilistic Programming System &rarr; Probabilistic Programming Language &rarr; Models &rarr; Applications

In this section we will give an overview of the modern landscape of <font color='orange'>probabilistic programming languages (PPLs)</font> and in the next section we will explore abilities of one of them (NumPyro). Familiarity with a PPL will equip participants with a tool allowing them to <font color='green'>focus on the scientific problem</font> of interest, while inference is being taken care of by the inference engine.

## Why do we need probabilistics programming

We will show how to use the [NumPyro](https://num.pyro.ai/en/latest/index.html#) library to perform exact Bayesian inference (using Markov Chain Monte Carlo).
Because writing your own sampler for Bayesian inference in hard! It involves complex mathematics, knoweldge and understanding of sampling algorithms - both MCMC and approximate, there are potential issues with numeric stability and computational cost. Hence, one needs to be both an excellent developer, as well as an expert statistician to succeed at this task.

Wouldn't it be wonderful to oursouce all these tasks to someone, so that we could focus on solving scientific problems?

## Probabilistic programming languages (PPLs)

An operative definition of probabilistic programming is as follows:
In this section we will give an overview of the modern landscape of <font color='orange'>probabilistic programming languages (PPLs)</font> and in the next section we will explore abilities of one of them. Familiarity with a PPL will equip participants with a tool allowing them to <font color='green'>focus on the scientific problem</font> of interest, while inference is being taken care of by the inference engine. For this purpose, we will intorduce the [NumPyro](https://num.pyro.ai/en/latest/index.html#) library to perform exact Bayesian inference (using Markov Chain Monte Carlo).

“Probabilistic programs are usual functional or imperative programs with two added constructs:

1. the ability to draw values at random from distributions, and
A PPL allows us to formalize a Bayesian model and perform inference with the help of powerful algorithms. **<font color='teal'>A user needs to only formulate the model</font>**, maybe chose a sampler, and "press the inference button".

2. the ability to condition values of variables in a program via observations.”
An operative definition of probabilistic programming is as follows:

*“Probabilistic programs are usual functional or imperative programs with two added constructs:
1. the ability to draw values at random from distributions, and
2. the ability to condition values of variables in a program via observations.”*
Gordon et al, 2014

Some (relatively) early Probabilistic programming languages and tools, such as BUGS and WinBUGS, showed the way. They had the three key capabiltiies:

Luckily, we do not need to write a sampler by hand every time, because PPLs are there to help.
- `random` to make random variables
- `constraint` to constraint variables e.g. to data
- `infer` - returns the dsitribution of a variable

A PPL allows us to formalize a Bayesian model and perform inference with the help of powerful algorithms. **<font color='teal'>A user needs to only formulate the model</font>** and maybe chose a sampler.

Luckily, we do not need to write a sampler by hand every time, because probabilistic programming languages (PPLs) are there to help.

A PPL allows to formalize a Bayesian model and perform inference with the help of powerful algorithms. A user needs to only formulate the model (and maybe chose a sampler) and press the inference button.

The list of currently existing PPLs is overwhelmingly long and only keeps growing:

BUGS, WinBUGS, JAGS,
Stan,
PyMC3, PyMC4,
Nimble,
Pyro,
Edward, TensorFlow Probability, Edward 2,
Gen,
Turing,
Stheno,
SOSS,
Omega,
Infer.NET
to name a few.size(chains)
- BUGS, WinBUGS, JAGS,
- Stan,
- PyMC3, PyMC4, PyMC,
- Nimble,
- Pyro, Numpyro,
- Edward, TensorFlow Probability, Edward 2,
- Gen,
- Turing,
- Stheno,
= SOSS,
- Omega,
- Infer.NET

to name a few.

## How to chose a PPL?
- Functionality: Evaluate the language's functionality by examining the availability of a wide range of probability distributions and samplers,
- ppenness to Customization: Consider whether the PPL allows you to define custom probability distributions and samplers,
- performance: Some PPLs may offer optimizations or parallel processing capabilities to improve performance,
- documentation: The availability of well-documented resources, including official documentation, tutorials, and guides, can significantly impact your learning curve and productivity. A well-documented PPL makes it easier to understand and use its features effectively.
- community Support: An active and supportive community can be an invaluable resource when you encounter challenges or have questions while working with the PPL. Community forums, discussion groups, and user-contributed content can provide guidance and solutions. Dedicated meetups and conferences.
- Integration: Consider whether the PPL can easily integrate with other tools and frameworks you may need for your project. Compatibility with libraries for data manipulation, visualization, or machine learning can streamline your workflow.

0 comments on commit 161b015

Please sign in to comment.