TensorFlow Probability

TensorFlow Probability is a library for probabilistic reasoning and statistical analysis in TensorFlow. As part of the TensorFlow ecosystem, TensorFlow Probability provides integration of probabilistic methods with deep networks, gradient-based inference using automatic differentiation, and scalability to large datasets and models with hardware acceleration (GPUs) and distributed computation.

To get started with TensorFlow Probability, see the install guide and view the Python notebook tutorials.

Components

Our probabilistic machine learning tools are structured as follows:

Layer 0: TensorFlow

Numerical operations—in particular, the LinearOperator class—enables matrix-free implementations that can exploit a particular structure (diagonal, low-rank, etc.) for efficient computation. It is built and maintained by the TensorFlow Probability team and is part of tf.linalg in core TensorFlow.

Layer 1: Statistical Building Blocks

Layer 2: Model Building

  • Joint Distributions (e.g., tfp.distributions.JointDistributionSequential): Joint distributions over one or more possibly-interdependent distributions. For an introduction to modeling with TFP's JointDistributions, check out this colab
  • Probabilistic layers (tfp.layers): Neural network layers with uncertainty over the functions they represent, extending TensorFlow layers.

Layer 3: Probabilistic Inference

  • Markov chain Monte Carlo (tfp.mcmc): Algorithms for approximating integrals via sampling. Includes Hamiltonian Monte Carlo, random-walk Metropolis-Hastings, and the ability to build custom transition kernels.
  • Variational Inference (tfp.vi): Algorithms for approximating integrals through optimization.
  • Optimizers (tfp.optimizer): Stochastic optimization methods, extending TensorFlow Optimizers. Includes Stochastic Gradient Langevin Dynamics.
  • Monte Carlo (tfp.monte_carlo): Tools for computing Monte Carlo expectations.

TensorFlow Probability is under active development and interfaces may change.

Examples

In addition to the Python notebook tutorials listed in the navigation, there are some example scripts available:

Report issues

Report bugs or feature requests using the TensorFlow Probability issue tracker.