Pre-release development of high-level probabilistic programming interface for TensorFlow. Please contribute or participate on github.
- Install using
pip
pip install --user git+https://github.com/pymc-devs/pymc4.git#egg=pymc4
import pymc4 as pm
from tensorflow_probability import edward2 as ed
model = pm.Model()
The model has to be defined in a single function with @[model-name].define
decorator.
@model.define
def simple(cfg):
normal = ed.Normal(loc=0., scale=1., name='normal')
trace = pm.sample(model)
# See https://github.com/arviz-devs/arviz
# pip install git+git:https://github.com/arviz-devs/arviz.git
import arviz as az
%matplotlib inline
posterior_data = az.convert_to_dataset(trace)
az.plot_posterior(posterior_data, figsize=(8, 4), textsize=15, round_to=2)
Here is a blog post showcasing the differences between PyMC3 and PyMC4 using the Eight Schools model.
For a full list of code contributors based on code checkin activity, see the GitHub contributor page.
As PyMC4 builds upon TensorFlow, particularly the TensorFlow Probability and Edward2 modules, its design is heavily influenced by innovations introduced in these packages. In particular, early development was partially derived from a prototype written by Josh Safyan.