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.
Our probabilistic machine learning tools are structured as follows:
Layer 0: TensorFlow
Numerical operations—in particular, the
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
in core TensorFlow.
Layer 1: Statistical Building Blocks
- Distributions (
tf.distributions): A large collection of probability distributions and related statistics with batch and broadcasting semantics.
- Bijectors (
tfp.bijectors): Reversible and composable transformations of random variables. Bijectors provide a rich class of transformed distributions, from classical examples like the log-normal distribution to sophisticated deep learning models such as masked autoregressive flows.
Layer 2: Model Building
- Edward2 (
tfp.edward2): A probabilistic programming language for specifying flexible probabilistic models as programs.
- Probabilistic layers (
tfp.layers): Neural network layers with uncertainty over the functions they represent, extending TensorFlow layers.
- Trainable distributions (
tfp.trainable_distributions): Probability distributions parameterized by a single tensor, making it easy to build neural nets that output probability distributions.
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.
In addition to the Python notebook tutorials listed in the navigation, there are some example scripts available:
- Variational Autoencoders —Representation learning with a latent code and variational inference.
- Vector-Quantized Autoencoder —Discrete representation learning with vector quantization.
- Bayesian Neural Networks —Neural networks with uncertainty over their weights.
- Bayesian Logistic Regression —Bayesian inference for binary classification.
Report bugs or feature requests using the TensorFlow Probability issue tracker.