Learn R Programming

⚠️There's a newer version (0.15.1) of this package.Take me there.

tfprobability: R interface to TensorFlow Probability

TensorFlow Probability is a library for statistical computation and probabilistic modeling built on top of TensorFlow.

Its building blocks include a vast range of distributions and invertible transformations (bijectors), probabilistic layers that may be used in keras models, and tools for probabilistic reasoning including variational inference and Markov Chain Monte Carlo.

Installation

Install the released version of tfprobability from CRAN:

install.packages("tfprobability")

To install tfprobability from github, do

devtools::install_github("rstudio/tfprobability")

Then, use the install_tfprobability() function to install TensorFlow and TensorFlow Probability python modules.

library(tfprobability)
install_tfprobability()

you will automatically get the current stable version of TensorFlow Probability together with TensorFlow. Correspondingly, if you need nightly builds,

install_tfprobability(version = "nightly")

will get you the nightly build of TensorFlow as well as TensorFlow Probability.

Usage

High-level application of tfprobability to tasks like

  • probabilistic (multi-level) modeling with MCMC and/or variational inference,
  • uncertainty estimation for neural networks,
  • time series modeling with state space models, or
  • density estimation with autoregressive flows

are described in the vignettes/articles and/or featured on the TensorFlow for R blog.

This introductory text illustrates the lower-level building blocks: distributions, bijectors, and probabilistic keras layers.

library(tfprobability)
library(tensorflow)
tf$compat$v2$enable_v2_behavior()

Distributions

Distributions are objects with methods to compute summary statistics, (log) probability, and (optionally) quantities like entropy and KL divergence.

Example: Binomial distribution

# create a binomial distribution with n = 7 and p = 0.3
d <- tfd_binomial(total_count = 7, probs = 0.3)

# compute mean
d %>% tfd_mean()
# compute variance
d %>% tfd_variance()
# compute probability
d %>% tfd_prob(2.3)

Example: Hidden Markov Model

# Represent a cold day with 0 and a hot day with 1.
# Suppose the first day of a sequence has a 0.8 chance of being cold.
# We can model this using the categorical distribution:
initial_distribution <- tfd_categorical(probs = c(0.8, 0.2))
# Suppose a cold day has a 30% chance of being followed by a hot day
# and a hot day has a 20% chance of being followed by a cold day.
# We can model this as:
transition_distribution <- tfd_categorical(
  probs = matrix(c(0.7, 0.3, 0.2, 0.8), nrow = 2, byrow = TRUE) %>% 
    tf$cast(tf$float32)
)
# Suppose additionally that on each day the temperature is
# normally distributed with mean and standard deviation 0 and 5 on
# a cold day and mean and standard deviation 15 and 10 on a hot day.
# We can model this with:
observation_distribution <- tfd_normal(loc = c(0, 15), scale = c(5, 10))
# We can combine these distributions into a single week long
# hidden Markov model with:
d <- tfd_hidden_markov_model(
  initial_distribution = initial_distribution,
  transition_distribution = transition_distribution,
  observation_distribution = observation_distribution,
  num_steps = 7
)
# The expected temperatures for each day are given by:
d %>% tfd_mean()  # shape [7], elements approach 9.0
# The log pdf of a week of temperature 0 is:
d %>% tfd_log_prob(rep(0, 7)) 

Bijectors

Bijectors are invertible transformations that allow to derive data likelihood under the transformed distribution from that under the base distribution. For an in-detail explanation, see Getting into the flow: Bijectors in TensorFlow Probability on the TensorFlow for R blog.

Affine bijector

# create an affine transformation that shifts by 3.33 and scales by 0.5
b <- tfb_affine_scalar(shift = 3.33, scale = 0.5)

# apply the transformation
x <- c(100, 1000, 10000)
b %>% tfb_forward(x)

Discrete cosine transform bijector

# create a bijector to that performs the discrete cosine transform (DCT)
b <- tfb_discrete_cosine_transform()

# run on sample data
x <- matrix(runif(3))
b %>% tfb_forward(x)

Keras layers

tfprobality wraps distributions in Keras layers so we can use them seemlessly in a neural network, and work with tensors as targets as usual. For example, we can use layer_kl_divergence_add_loss to have the network take care of the KL loss automatically, and train a variational autoencoder with just negative log likelihood only, like this:

library(keras)

encoded_size <- 2
input_shape <- c(2L, 2L, 1L)
train_size <- 100
x_train <- array(runif(train_size * Reduce(`*`, input_shape)), dim = c(train_size, input_shape))

# encoder is a keras sequential model
encoder_model <- keras_model_sequential() %>%
  layer_flatten(input_shape = input_shape) %>%
  layer_dense(units = 10, activation = "relu") %>%
  layer_dense(units = params_size_multivariate_normal_tri_l(encoded_size)) %>%
  layer_multivariate_normal_tri_l(event_size = encoded_size) %>%
  # last layer adds KL divergence loss
  layer_kl_divergence_add_loss(
      distribution = tfd_independent(
        tfd_normal(loc = c(0, 0), scale = 1),
        reinterpreted_batch_ndims = 1
      ),
      weight = train_size)

# decoder is a keras sequential model
decoder_model <- keras_model_sequential() %>%
  layer_dense(units = 10,
              activation = 'relu',
              input_shape = encoded_size) %>%
  layer_dense(params_size_independent_bernoulli(input_shape)) %>%
  layer_independent_bernoulli(event_shape = input_shape,
                              convert_to_tensor_fn = tfp$distributions$Bernoulli$logits)

# keras functional model uniting them both
vae_model <- keras_model(inputs = encoder_model$inputs,
                         outputs = decoder_model(encoder_model$outputs[1]))

# VAE loss now is just log probability of the data
vae_loss <- function (x, rv_x)
    - (rv_x %>% tfd_log_prob(x))

vae_model %>% compile(
  optimizer = "adam",
  loss = vae_loss
)

vae_model %>% fit(x_train, x_train, batch_size = 25, epochs = 1)

Copy Link

Version

Install

install.packages('tfprobability')

Monthly Downloads

510

Version

0.12.0.0

License

Apache License (>= 2.0)

Issues

Pull Requests

Stars

Forks

Maintainer

Sigrid Keydana

Last Published

May 20th, 2021

Functions in tfprobability (0.12.0.0)

glm_families

GLM families
layer_categorical_mixture_of_one_hot_categorical

A OneHotCategorical mixture Keras layer from k * (1 + d) params.
glm_fit.tensorflow.tensor

Runs multiple Fisher scoring steps
layer_autoregressive

Masked Autoencoder for Distribution Estimation
glm_fit

Runs multiple Fisher scoring steps
install_tfprobability

Installs TensorFlow Probability
glm_fit_one_step.tensorflow.tensor

Runs one Fisher Scoring step
layer_autoregressive_transform

An autoregressive normalizing flow layer, given a layer_autoregressive.
glm_fit_one_step

Runs one Fisher scoring step
initializer_blockwise

Blockwise Initializer
layer_conv_2d_flipout

2D convolution layer (e.g. spatial convolution over images) with Flipout
layer_conv_1d_reparameterization

1D convolution layer (e.g. temporal convolution).
layer_conv_1d_flipout

1D convolution layer (e.g. temporal convolution) with Flipout
layer_conv_3d_flipout

3D convolution layer (e.g. spatial convolution over volumes) with Flipout
layer_conv_3d_reparameterization

3D convolution layer (e.g. spatial convolution over volumes)
layer_independent_normal

An independent Normal Keras layer.
layer_dense_variational

Dense Variational Layer
layer_dense_reparameterization

Densely-connected layer class with reparameterization estimator.
layer_independent_logistic

An independent Logistic Keras layer.
layer_independent_poisson

An independent Poisson Keras layer.
layer_kl_divergence_add_loss

Pass-through layer that adds a KL divergence penalty to the model loss
layer_distribution_lambda

Keras layer enabling plumbing TFP distributions through Keras models
layer_independent_bernoulli

An Independent-Bernoulli Keras layer from prod(event_shape) params
layer_conv_2d_reparameterization

2D convolution layer (e.g. spatial convolution over images)
layer_mixture_same_family

A mixture (same-family) Keras layer.
layer_variational_gaussian_process

A Variational Gaussian Process Layer.
layer_variable

Variable Layer
layer_mixture_normal

A mixture distribution Keras layer, with independent normal components.
layer_kl_divergence_regularizer

Regularizer that adds a KL divergence penalty to the model loss
mcmc_hamiltonian_monte_carlo

Runs one step of Hamiltonian Monte Carlo.
layer_mixture_logistic

A mixture distribution Keras layer, with independent logistic components.
mcmc_transformed_transition_kernel

Applies a bijector to the MCMC's state space
layer_multivariate_normal_tri_l

A d-variate Multivariate Normal TriL Keras layer from d+d*(d+1)/ 2 params
layer_one_hot_categorical

A d-variate OneHotCategorical Keras layer from d params.
mcmc_uncalibrated_hamiltonian_monte_carlo

Runs one step of Uncalibrated Hamiltonian Monte Carlo
layer_dense_local_reparameterization

Densely-connected layer class with local reparameterization estimator.
mcmc_dual_averaging_step_size_adaptation

Adapts the inner kernel's step_size based on log_accept_prob.
layer_dense_flipout

Densely-connected layer class with Flipout estimator.
mcmc_simple_step_size_adaptation

Adapts the inner kernel's step_size based on log_accept_prob.
params_size_mixture_normal

number of params needed to create a MixtureNormal distribution
mcmc_slice_sampler

Runs one step of the slice sampler using a hit and run approach
params_size_mixture_same_family

number of params needed to create a MixtureSameFamily distribution
mcmc_effective_sample_size

Estimate a lower bound on effective sample size for each independent chain.
params_size_independent_bernoulli

number of params needed to create an IndependentBernoulli distribution
params_size_categorical_mixture_of_one_hot_categorical

number of params needed to create a CategoricalMixtureOfOneHotCategorical distribution
mcmc_replica_exchange_mc

Runs one step of the Replica Exchange Monte Carlo
params_size_independent_logistic

number of params needed to create an IndependentLogistic distribution
params_size_independent_normal

number of params needed to create an IndependentNormal distribution
mcmc_sample_annealed_importance_chain

Runs annealed importance sampling (AIS) to estimate normalizing constants.
sts_autoregressive_state_space_model

State space model for an autoregressive process.
sts_decompose_by_component

Decompose an observed time series into contributions from each component.
sts_autoregressive

Formal representation of an autoregressive model.
sts_constrained_seasonal_state_space_model

Seasonal state space model with effects constrained to sum to zero.
mcmc_metropolis_hastings

Runs one step of the Metropolis-Hastings algorithm.
mcmc_no_u_turn_sampler

Runs one step of the No U-Turn Sampler
mcmc_metropolis_adjusted_langevin_algorithm

Runs one step of Metropolis-adjusted Langevin algorithm.
params_size_one_hot_categorical

number of params needed to create a OneHotCategorical distribution
params_size_multivariate_normal_tri_l

number of params needed to create a MultivariateNormalTriL distribution
mcmc_uncalibrated_langevin

Runs one step of Uncalibrated Langevin discretized diffusion.
sts_forecast

Construct predictive distribution over future observations
mcmc_potential_scale_reduction

Gelman and Rubin (1992)'s potential scale reduction for chain convergence.
mcmc_uncalibrated_random_walk

Generate proposal for the Random Walk Metropolis algorithm.
mcmc_random_walk_metropolis

Runs one step of the RWM algorithm with symmetric proposal.
params_size_independent_poisson

number of params needed to create an IndependentPoisson distribution
mcmc_sample_chain

Implements Markov chain Monte Carlo via repeated TransitionKernel steps.
mcmc_sample_halton_sequence

Returns a sample from the dim dimensional Halton sequence.
sts_dynamic_linear_regression_state_space_model

State space model for a dynamic linear regression from provided covariates.
sts_fit_with_hmc

Draw posterior samples using Hamiltonian Monte Carlo (HMC)
sts_local_linear_trend

Formal representation of a local linear trend model
sts_linear_regression

Formal representation of a linear regression from provided covariates.
sts_additive_state_space_model

A state space model representing a sum of component state space models.
sts_local_level_state_space_model

State space model for a local level
sts_local_level

Formal representation of a local level model
reexports

Objects exported from other packages
sts_sparse_linear_regression

Formal representation of a sparse linear regression.
sts_sum

Sum of structural time series components.
sts_semi_local_linear_trend_state_space_model

State space model for a semi-local linear trend.
sts_semi_local_linear_trend

Formal representation of a semi-local linear trend model.
sts_sample_uniform_initial_state

Initialize from a uniform [-2, 2] distribution in unconstrained space.
sts_local_linear_trend_state_space_model

State space model for a local linear trend
sts_one_step_predictive

Compute one-step-ahead predictive distributions for all timesteps
sts_smooth_seasonal_state_space_model

State space model for a smooth seasonal effect
params_size_mixture_logistic

number of params needed to create a MixtureLogistic distribution
sts_build_factored_variational_loss

Build a loss function for variational inference in STS models.
sts_dynamic_linear_regression

Formal representation of a dynamic linear regression model.
sts_decompose_forecast_by_component

Decompose a forecast distribution into contributions from each component.
sts_build_factored_surrogate_posterior

Build a variational posterior that factors over model parameters.
sts_smooth_seasonal

Formal representation of a smooth seasonal effect model
sts_seasonal

Formal representation of a seasonal effect model.
sts_seasonal_state_space_model

State space model for a seasonal effect.
tfb_blockwise

Bijector which applies a list of bijectors to blocks of a Tensor
tfb_ascending

Maps unconstrained R^n to R^n in ascending order.
tfb_affine

Affine bijector
tfb_absolute_value

ComputesY = g(X) = Abs(X), element-wise
tfb_cholesky_outer_product

Computesg(X) = X @ X.T where X is lower-triangular, positive-diagonal matrix
tfb_cholesky_to_inv_cholesky

Maps the Cholesky factor of M to the Cholesky factor of M^{-1}
tfb_forward

Returns the forward Bijector evaluation, i.e., X = g(Y).
tfb_chain

Bijector which applies a sequence of bijectors
tfb_expm1

ComputesY = g(X) = exp(X) - 1
tfb_forward_log_det_jacobian

Returns the result of the forward evaluation of the log determinant of the Jacobian
tfb_fill_scale_tri_l

Transforms unconstrained vectors to TriL matrices with positive diagonal
tfb_ffjord

Implements a continuous normalizing flow X->Y defined via an ODE.
tfb_affine_linear_operator

ComputesY = g(X; shift, scale) = scale @ X + shift
tfb_affine_scalar

AffineScalar bijector
tfb_correlation_cholesky

Maps unconstrained reals to Cholesky-space correlation matrices.
tfb_cumsum

Computes the cumulative sum of a tensor along a specified axis.
tfb_discrete_cosine_transform

ComputesY = g(X) = DCT(X), where DCT type is indicated by the type arg
tfb_batch_normalization

ComputesY = g(X) s.t. X = g^-1(Y) = (Y - mean(Y)) / std(Y)
tfb_exp

ComputesY=g(X)=exp(X)
tfb_fill_triangular

Transforms vectors to triangular
tfb_gumbel_cdf

Compute Y = g(X) = exp(-exp(-(X - loc) / scale)), the Gumbel CDF.
tfb_iterated_sigmoid_centered

Bijector which applies a Stick Breaking procedure.
tfb_inverse_log_det_jacobian

Returns the result of the inverse evaluation of the log determinant of the Jacobian
tfb_inline

Bijector constructed from custom functions
tfb_invert

Bijector which inverts another Bijector
tfb_identity

ComputesY = g(X) = X
tfb_inverse

Returns the inverse Bijector evaluation, i.e., X = g^{-1}(Y).
tfb_gumbel

ComputesY = g(X) = exp(-exp(-(X - loc) / scale))
tfb_glow

Implements the Glow Bijector from Kingma & Dhariwal (2018).
tfb_gompertz_cdf

Compute Y = g(X) = 1 - exp(-c * (exp(rate * X) - 1), the Gompertz CDF.
tfb_masked_autoregressive_flow

Affine MaskedAutoregressiveFlow bijector
tfb_ordered

Bijector which maps a tensor x_k that has increasing elements in the last dimension to an unconstrained tensor y_k
tfb_normal_cdf

ComputesY = g(X) = NormalCDF(x)
tfb_masked_dense

Autoregressively masked dense layer
tfb_matvec_lu

Matrix-vector multiply using LU decomposition
tfb_matrix_inverse_tri_l

Computes g(L) = inv(L), where L is a lower-triangular matrix
tfb_kumaraswamy

ComputesY = g(X) = (1 - (1 - X)**(1 / b))**(1 / a), with X in [0, 1]
tfb_kumaraswamy_cdf

ComputesY = g(X) = (1 - (1 - X)**(1 / b))**(1 / a), with X in [0, 1]
tfb_masked_autoregressive_default_template

Masked Autoregressive Density Estimator
tfb_lambert_w_tail

LambertWTail transformation for heavy-tail Lambert W x F random variables.
tfb_power_transform

ComputesY = g(X) = (1 + X * c)**(1 / c), where X >= -1 / c
tfb_rational_quadratic_spline

A piecewise rational quadratic spline, as developed in Conor et al.(2019).
tfb_pad

Pads a value to the event_shape of a Tensor.
tfb_permute

Permutes the rightmost dimension of a Tensor
tfb_reshape

Reshapes the event_shape of a Tensor
tfb_scale

Compute Y = g(X; scale) = scale * X.
tfb_reciprocal

A Bijector that computes b(x) = 1. / x
tfb_real_nvp_default_template

Build a scale-and-shift function using a multi-layer neural network
tfb_rayleigh_cdf

Compute Y = g(X) = 1 - exp( -(X/scale)**2 / 2 ), X >= 0.
tfb_real_nvp

RealNVP affine coupling layer for vector-valued events
tfb_scale_matvec_linear_operator

Compute Y = g(X; scale) = scale @ X.
tfb_scale_matvec_diag

Compute Y = g(X; scale) = scale @ X
tfb_shifted_gompertz_cdf

Compute Y = g(X) = (1 - exp(-rate * X)) * exp(-c * exp(-rate * X))
tfb_sigmoid

ComputesY = g(X) = 1 / (1 + exp(-X))
tfb_scale_matvec_tri_l

Compute Y = g(X; scale) = scale @ X.
tfb_scale_matvec_lu

Matrix-vector multiply using LU decomposition.
tfb_shift

Compute Y = g(X; shift) = X + shift.
tfb_scale_tri_l

Transforms unconstrained vectors to TriL matrices with positive diagonal
tfb_tanh

Computes Y = tanh(X)
tfb_square

Computesg(X) = X^2; X is a positive real number.
tfb_softplus

Computes Y = g(X) = Log[1 + exp(X)]
tfb_softmax_centered

Computes Y = g(X) = exp([X 0]) / sum(exp([X 0]))
tfb_transpose

ComputesY = g(X) = transpose_rightmost_dims(X, rightmost_perm)
tfb_transform_diagonal

Applies a Bijector to the diagonal of a matrix
tfb_sinh

Bijector that computes Y = sinh(X).
tfb_sinh_arcsinh

ComputesY = g(X) = Sinh( (Arcsinh(X) + skewness) * tailweight )
tfd_autoregressive

Autoregressive distribution
tfd_batch_reshape

Batch-Reshaping distribution
tfb_split

Split a Tensor event along an axis into a list of Tensors.
tfd_bernoulli

Bernoulli distribution
tfd_bates

Bates distribution.
tfb_softsign

Computes Y = g(X) = X / (1 + |X|)
tfb_weibull

ComputesY = g(X) = 1 - exp((-X / scale) ** concentration) where X >= 0
tfd_binomial

Binomial distribution
tfd_blockwise

Blockwise distribution
tfd_categorical

Categorical distribution over integers
tfd_cauchy

Cauchy distribution with location loc and scale scale
tfb_weibull_cdf

Compute Y = g(X) = 1 - exp((-X / scale) ** concentration), X >= 0.
tfd_continuous_bernoulli

Continuous Bernoulli distribution.
tfd_covariance

Covariance.
tfd_beta_binomial

Beta-Binomial compound distribution
tfd_chi

Chi distribution
tfd_beta

Beta distribution
tfd_cdf

Cumulative distribution function. Given random variable X, the cumulative distribution function cdf is: cdf(x) := P[X <= x]
tfd_cross_entropy

Computes the (Shannon) cross entropy.
tfd_deterministic

Scalar Deterministic distribution on the real line
tfd_dirichlet_multinomial

Dirichlet-Multinomial compound distribution
tfd_dirichlet

Dirichlet distribution
tfd_chi2

Chi Square distribution
tfd_cholesky_lkj

The CholeskyLKJ distribution on cholesky factors of correlation matrices
tfd_exp_relaxed_one_hot_categorical

ExpRelaxedOneHotCategorical distribution with temperature and logits.
tfd_exp_inverse_gamma

ExpInverseGamma distribution.
tfd_gamma_gamma

Gamma-Gamma distribution
tfd_gamma

Gamma distribution
tfd_finite_discrete

The finite discrete distribution.
tfd_exponential

Exponential distribution
tfd_entropy

Shannon entropy in nats.
tfd_exp_gamma

ExpGamma distribution.
tfd_doublesided_maxwell

Double-sided Maxwell distribution.
tfd_empirical

Empirical distribution
tfd_generalized_normal

The Generalized Normal distribution.
tfd_half_normal

Half-Normal distribution with scale scale
tfd_geometric

Geometric distribution
tfd_generalized_pareto

The Generalized Pareto distribution.
tfd_half_cauchy

Half-Cauchy distribution
tfd_gaussian_process

Marginal distribution of a Gaussian process at finitely many points.
tfd_gumbel

Scalar Gumbel distribution with location loc and scale parameters
tfd_horseshoe

Horseshoe distribution
tfd_gaussian_process_regression_model

Posterior predictive distribution in a conjugate GP regression model.
tfd_hidden_markov_model

Hidden Markov model distribution
tfd_kl_divergence

Computes the Kullback--Leibler divergence.
tfd_joint_distribution_sequential_auto_batched

Joint distribution parameterized by distribution-making functions.
tfd_joint_distribution_sequential

Joint distribution parameterized by distribution-making functions
tfd_joint_distribution_named_auto_batched

Joint distribution parameterized by named distribution-making functions.
tfd_joint_distribution_named

Joint distribution parameterized by named distribution-making functions.
tfd_inverse_gamma

InverseGamma distribution
tfd_independent

Independent distribution from batch of distributions
tfd_inverse_gaussian

Inverse Gaussian distribution
tfd_johnson_s_u

Johnson's SU-distribution.
tfd_log_cdf

Log cumulative distribution function.
tfd_lkj

LKJ distribution on correlation matrices
tfd_log_normal

Log-normal distribution
tfd_log_logistic

The log-logistic distribution.
tfd_logit_normal

The Logit-Normal distribution
tfd_logistic

Logistic distribution with location loc and scale parameters
tfd_kumaraswamy

Kumaraswamy distribution
tfd_linear_gaussian_state_space_model

Observation distribution from a linear Gaussian state space model
tfd_laplace

Laplace distribution with location loc and scale parameters
tfd_log_prob

Log probability density/mass function.
tfd_log_survival_function

Log survival function.
tfd_mode

Mode.
tfd_multinomial

Multinomial distribution
tfd_multivariate_normal_diag_plus_low_rank

Multivariate normal distribution on R^k
tfd_multivariate_normal_diag

Multivariate normal distribution on R^k
tfd_mixture_same_family

Mixture (same-family) distribution
tfd_mixture

Mixture distribution
tfd_mean

Mean.
tfd_multivariate_normal_linear_operator

The multivariate normal distribution on R^k
tfd_multivariate_normal_tri_l

The multivariate normal distribution on R^k
tfd_multivariate_normal_full_covariance

Multivariate normal distribution on R^k
tfd_negative_binomial

NegativeBinomial distribution
tfd_plackett_luce

Plackett-Luce distribution over permutations.
tfd_pareto

Pareto distribution
tfd_normal

Normal distribution with loc and scale parameters
tfd_multivariate_student_t_linear_operator

Multivariate Student's t-distribution on R^k
tfd_pixel_cnn

The Pixel CNN++ distribution
tfd_one_hot_categorical

OneHotCategorical distribution
tfd_poisson_log_normal_quadrature_compound

PoissonLogNormalQuadratureCompound distribution
tfd_pert

Modified PERT distribution for modeling expert predictions.
tfd_poisson

Poisson distribution
tfd_probit_bernoulli

ProbitBernoulli distribution.
tfd_prob

Probability density/mass function.
tfd_power_spherical

The Power Spherical distribution over unit vectors on S^{n-1}.
tfd_relaxed_bernoulli

RelaxedBernoulli distribution with temperature and logits parameters
tfd_quantized

Distribution representing the quantization Y = ceiling(X)
tfd_sample

Generate samples of the specified shape.
tfd_relaxed_one_hot_categorical

RelaxedOneHotCategorical distribution with temperature and logits
tfd_sample_distribution

Sample distribution via independent draws.
tfd_sinh_arcsinh

The SinhArcsinh transformation of a distribution on (-inf, inf)
tfd_quantile

Quantile function. Aka "inverse cdf" or "percent point function".
tfd_stddev

Standard deviation.
tfd_spherical_uniform

The uniform distribution over unit vectors on S^{n-1}.
tfd_survival_function

Survival function.
tfd_transformed_distribution

A Transformed Distribution
tfd_student_t_process

Marginal distribution of a Student's T process at finitely many points
tfd_student_t

Student's t-distribution
tfd_skellam

Skellam distribution.
tfd_truncated_normal

Truncated Normal distribution
tfd_truncated_cauchy

The Truncated Cauchy distribution.
tfd_triangular

Triangular distribution with low, high and peak parameters
tfd_vector_diffeomixture

VectorDiffeomixture distribution
tfd_uniform

Uniform distribution with low and high parameters
tfd_vector_exponential_diag

The vectorization of the Exponential distribution on R^k
tfd_vector_laplace_diag

The vectorization of the Laplace distribution on R^k
tfd_vector_laplace_linear_operator

The vectorization of the Laplace distribution on R^k
tfd_vector_exponential_linear_operator

The vectorization of the Exponential distribution on R^k
tfd_vector_sinh_arcsinh_diag

The (diagonal) SinhArcsinh transformation of a distribution on R^k
tfd_vector_deterministic

Vector Deterministic Distribution
tfd_variational_gaussian_process

Posterior predictive of a variational Gaussian process
tfd_variance

Variance.
tfd_wishart_tri_l

The matrix Wishart distribution parameterized with Cholesky factors.
vi_amari_alpha

The Amari-alpha Csiszar-function in log-space
tfd_wishart

The matrix Wishart distribution on positive definite matrices
tfp_version

TensorFlow Probability Version
tfd_weibull

The Weibull distribution with 'concentration' and scale parameters.
tfd_wishart_linear_operator

The matrix Wishart distribution on positive definite matrices
tfd_von_mises_fisher

The von Mises-Fisher distribution over unit vectors on S^{n-1}
tfd_von_mises

The von Mises distribution over angles
tfp

Handle to the tensorflow_probability module
tfd_zipf

Zipf distribution
vi_arithmetic_geometric

The Arithmetic-Geometric Csiszar-function in log-space
vi_kl_forward

The forward Kullback-Leibler Csiszar-function in log-space
vi_jensen_shannon

The Jensen-Shannon Csiszar-function in log-space
vi_modified_gan

The Modified-GAN Csiszar-function in log-space
vi_fit_surrogate_posterior

Fit a surrogate posterior to a target (unnormalized) log density
vi_jeffreys

The Jeffreys Csiszar-function in log-space
vi_monte_carlo_variational_loss

Monte-Carlo approximation of an f-Divergence variational loss
vi_squared_hellinger

The Squared-Hellinger Csiszar-function in log-space
vi_pearson

The Pearson Csiszar-function in log-space
vi_kl_reverse

The reverse Kullback-Leibler Csiszar-function in log-space
vi_symmetrized_csiszar_function

Symmetrizes a Csiszar-function in log-space
vi_t_power

The T-Power Csiszar-function in log-space
vi_log1p_abs

The log1p-abs Csiszar-function in log-space
vi_chi_square

The chi-square Csiszar-function in log-space
vi_triangular

The Triangular Csiszar-function in log-space
vi_total_variation

The Total Variation Csiszar-function in log-space
vi_csiszar_vimco

Use VIMCO to lower the variance of the gradient of csiszar_function(Avg(logu))
vi_dual_csiszar_function

Calculates the dual Csiszar-function in log-space