Skip to content

A place to showcase my Google Summer of Code 2018 work with PyMC4

Notifications You must be signed in to change notification settings

sharanry/gsoc18

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

My Google Summer of Code 2018 project

Sub-org: PyMC

Introduction

PyMC4 is a high-level probabilistic programming interface for TensorFlow. We use the capabilities of Edward2 and tensorflow_probability to make user-friendly, functional API.

Edward2 provides us with distributions and some sampling techniques. We combine these to build a user focused API.

Functional Design

Tensorflow and Edward 2 use a functional approach, where each Tensorflow program is defined as a function that takes a tensor as input and outputs a tensor. We extend this design to the PyMC4 API.

Interceptors

Edward2 wraps a tensorflow distribution as a function and makes it interceptable.

We make use of these interceptions for sampling, keeping track of variables, etc.

Collaboration with the Google tf.probability Team

The PyMC team has been coordinating with the Google tensorflow/probability team to fix existing and potential implementation problems of PyMC4 or Tensorflow Probability.

Work Done

Tested context manager based API Link

I started the project by trying to replicate the existing API of PyMC3. This design relied on context manager which kept track of random variables. I got this design to sampling stage. However we (PyMC team and I) soon realized that we are not making use of TensorFlow's functional design properly.

Functional API

The functional API of PyMC4 is an effort to extend the functional design of Tensorflow probability and Edward2 to PyMC4 and fully make use of all their capabilities.

  • Took the prototype designed by Josh Safyan and adopted it to our functional design.
  • Got the models to sample using HMC.
  • Reproduced the famous Eight Schools Model using PyMC4 comparing it with the PyMC3 implementation. Link

Solving the Graph growth Problem

  • There is problem of tensorflow graph growth while sampling or specifically while evaluating log probability. This problem has been demonstrated in this notebook and this blog post. The tensorflow team is actively helping in solving this problem.

Half Cauchy Distribution

Tensorflow Probability lacks Half Cauchy distribution which is often used in many probabilistic models. The PR for adding this to PyMC4 is in the process of being merged.

My Blog Posts

My PRs

Credits

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.

About

A place to showcase my Google Summer of Code 2018 work with PyMC4

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published