Skip to content
forked from pymc-devs/pymc4

Pre-release development of high-level probabilistic programming interface for TensorFlow

License

Notifications You must be signed in to change notification settings

yukinagae/pymc4

 
 

Repository files navigation

PyMC4

Pre-release development of high-level probabilistic programming interface for TensorFlow. Please contribute or participate on github.

Installation Instructions

  • Install using pip
pip install --user git+https://github.com/pymc-devs/pymc4.git#egg=pymc4

Simple Example

Import pymc4 and Edward2

import pymc4 as pm
from tensorflow_probability import edward2 as ed

Model Initialization

model = pm.Model()

Model Definition

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')

Sampling

trace = pm.sample(model)

Visualize the trace using arviz

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

Contributors

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.

License

Apache License, Version 2.0

About

Pre-release development of high-level probabilistic programming interface for TensorFlow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 88.6%
  • Python 11.4%