InferPy: Deep Probabilistic Modeling with TensorFlow Made Easy


InferPy is a high-level API for probabilistic modeling with deep neural networks written in Python and capable of running on top of TensorFlow. InferPy’s API is strongly inspired by Keras and it has a focus on enabling flexible data processing, easy-to-code probabilistic modeling, scalable inference, and robust model validation.

Use InferPy if you need a probabilistic programming language that:

  • Allows easy and fast prototyping of hierarchical probabilistic models with a simple and user-friendly API inspired by Keras.

  • Automatically creates computational efficient batch models without the need to deal with complex tensor operations and theoretical concepts.

  • Run seamlessly on CPU and GPU by relying on TensorFlow, without having to learn how to use TensorFlow.

  • Defines probabilistic models with complex probabilistic constructs containing deep neural networks.

Code examples

A set of examples of models defined with InferPy can be found in the Probabilistic Model Zoo section. Additionally, more complex examples are provided: model with Bayesian NN and a mixture density network.


There are several articles to cite for InferPy. The following one correspond to versions 1.x and describes the use of InferPy for probabilistic modelling with neural networks. This InferPy version relies on TensorFlow Probability (TFP) and Edward2.

     author  = {C{\'o}zar, Javier and Caba{\~n}as, Rafael and Salmer{\'o}n, Antonio and  Masegosa, Andr{\'e}s R},
     title   = {InferPy: Probabilistic Modeling with Deep Neural Networks Made Easy},
     journal = {arXiv preprint arXiv:1908.11161},
     year    = {2019},

On the other hand, the article whose reference is shown below corresponds to the API in verions 0.x which relies on the first version of Edward, which is no longer under development:

     Author = {Caba{\~n}as, Rafael and Salmer{\'o}n, Antonio and Masegosa, Andr{\'e}s R},
     Journal = {Knowledge-Based Systems},
     Publisher = {Elsevier},
     Title = {InferPy: Probabilistic Modeling with TensorFlow Made Easy},
     Year = {2019}