Distributions

tfd_autoregressive()

Autoregressive distribution

tfd_batch_reshape()

Batch-Reshaping distribution

tfd_bernoulli()

Bernoulli distribution

tfd_beta()

Beta distribution

tfd_binomial()

Binomial distribution

tfd_categorical()

Categorical distribution over integers

tfd_cauchy()

Cauchy distribution with location loc and scale scale

tfd_chi()

Chi distribution

tfd_chi2()

Chi Square distribution

tfd_cholesky_lkj()

The CholeskyLKJ distribution on cholesky factors of correlation matrices

tfd_deterministic()

Scalar Deterministic distribution on the real line

tfd_dirichlet()

Dirichlet distribution

tfd_dirichlet_multinomial()

Dirichlet-Multinomial compound distribution

tfd_empirical()

Empirical distribution

tfd_exponential()

Exponential distribution

tfd_gamma()

Gamma distribution

tfd_gamma_gamma()

Gamma-Gamma distribution

tfd_gaussian_process()

Marginal distribution of a Gaussian process at finitely many points.

tfd_gaussian_process_regression_model()

Posterior predictive distribution in a conjugate GP regression model.

tfd_geometric()

Geometric distribution

tfd_gumbel()

Scalar Gumbel distribution with location loc and scale parameters

tfd_half_cauchy()

Half-Cauchy distribution

tfd_half_normal()

Half-Normal distribution with scale scale

tfd_hidden_markov_model()

Hidden Markov model distribution

tfd_horseshoe()

Horseshoe distribution

tfd_independent()

Independent distribution from batch of distributions

tfd_inverse_gamma()

InverseGamma distribution

tfd_inverse_gaussian()

Inverse Gaussian distribution

tfd_joint_distribution_named()

Joint distribution parameterized by named distribution-making functions.

tfd_joint_distribution_sequential()

Joint distribution parameterized by distribution-making functions

tfd_kumaraswamy()

Kumaraswamy distribution

tfd_laplace()

Laplace distribution with location loc and scale parameters

tfd_linear_gaussian_state_space_model()

Observation distribution from a linear Gaussian state space model

tfd_lkj()

LKJ distribution on correlation matrices

tfd_log_normal() tfd_log_normal()

Log-normal distribution

tfd_logistic()

Logistic distribution with location loc and scale parameters

tfd_mixture()

Mixture distribution

tfd_mixture_same_family()

Mixture (same-family) distribution

tfd_multinomial()

Multinomial distribution

tfd_multivariate_normal_diag()

Multivariate normal distribution on R^k

tfd_multivariate_normal_diag_plus_low_rank()

Multivariate normal distribution on R^k

tfd_multivariate_normal_full_covariance()

Multivariate normal distribution on R^k

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_student_t_linear_operator()

Multivariate Student's t-distribution on R^k

tfd_negative_binomial()

NegativeBinomial distribution

tfd_normal()

Normal distribution with loc and scale parameters

tfd_one_hot_categorical()

OneHotCategorical distribution

tfd_pareto()

Pareto distribution

tfd_pixel_cnn()

The Pixel CNN++ distribution

tfd_poisson()

Poisson distribution

tfd_poisson_log_normal_quadrature_compound()

PoissonLogNormalQuadratureCompound distribution

tfd_probit_bernoulli()

ProbitBernoulli distribution.

tfd_quantized()

Distribution representing the quantization Y = ceiling(X)

tfd_relaxed_bernoulli()

RelaxedBernoulli distribution with temperature and logits parameters

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_student_t()

Student's t-distribution

tfd_student_t_process()

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

tfd_transformed_distribution()

A Transformed Distribution

tfd_triangular()

Triangular distribution with low, high and peak parameters

tfd_truncated_normal()

Truncated Normal distribution

tfd_uniform()

Uniform distribution with low and high parameters

tfd_variational_gaussian_process()

Posterior predictive of a variational Gaussian process

tfd_vector_diffeomixture()

VectorDiffeomixture distribution

tfd_vector_exponential_diag()

The vectorization of the Exponential distribution on R^k

tfd_vector_exponential_linear_operator()

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_sinh_arcsinh_diag()

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

tfd_von_mises()

The von Mises distribution over angles

tfd_von_mises_fisher()

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

tfd_wishart()

The matrix Wishart distribution on positive definite matrices

tfd_wishart_linear_operator()

The matrix Wishart distribution on positive definite matrices

tfd_wishart_tri_l()

The matrix Wishart distribution parameterized with Cholesky factors.

tfd_zipf()

Zipf distribution

Distribution methods

tfd_cdf()

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

tfd_covariance()

Covariance.

tfd_cross_entropy()

Computes the (Shannon) cross entropy.

tfd_entropy()

Shannon entropy in nats.

tfd_kl_divergence()

Computes the Kullback--Leibler divergence.

tfd_log_cdf()

Log cumulative distribution function.

tfd_log_prob()

Log probability density/mass function.

tfd_log_survival_function()

Log survival function.

tfd_mean()

Mean.

tfd_mode()

Mode.

tfd_prob()

Probability density/mass function.

tfd_quantile()

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

tfd_sample()

Generate samples of the specified shape.

tfd_stddev()

Standard deviation.

tfd_survival_function()

Survival function.

tfd_variance()

Variance.

Keras layers: Distribution layers

layer_categorical_mixture_of_one_hot_categorical()

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

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_independent_logistic()

An independent Logistic Keras layer.

layer_independent_normal()

An independent Normal 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_kl_divergence_regularizer()

Regularizer that adds a KL divergence penalty to the model loss

layer_mixture_logistic()

A mixture distribution Keras layer, with independent logistic components.

layer_mixture_normal()

A mixture distribution Keras layer, with independent normal components.

layer_mixture_same_family()

A mixture (same-family) Keras layer.

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.

Keras layers: Other

layer_autoregressive()

Masked Autoencoder for Distribution Estimation

layer_conv_1d_flipout()

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

layer_conv_1d_reparameterization()

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

layer_conv_2d_flipout()

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

layer_conv_2d_reparameterization()

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

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_dense_flipout()

Densely-connected layer class with Flipout estimator.

layer_dense_local_reparameterization()

Densely-connected layer class with local reparameterization estimator.

layer_dense_reparameterization()

Densely-connected layer class with reparameterization estimator.

layer_dense_variational()

Dense Variational Layer

layer_variable()

Variable Layer

Bijectors

tfb_absolute_value()

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

tfb_affine()

Affine bijector

tfb_affine_linear_operator()

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

tfb_affine_scalar()

AffineScalar bijector

tfb_batch_normalization()

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

tfb_blockwise()

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

tfb_chain()

Bijector which applies a sequence of bijectors

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_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_exp()

ComputesY=g(X)=exp(X)

tfb_expm1()

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

tfb_ffjord()

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

tfb_fill_scale_tri_l()

Transforms unconstrained vectors to TriL matrices with positive diagonal

tfb_fill_triangular()

Transforms vectors to triangular

tfb_gumbel()

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

tfb_gumbel_cdf()

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

tfb_identity()

ComputesY = g(X) = X

tfb_inline()

Bijector constructed from custom functions

tfb_invert()

Bijector which inverts another Bijector

tfb_iterated_sigmoid_centered()

Bijector which applies a Stick Breaking procedure.

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_masked_autoregressive_flow()

Affine MaskedAutoregressiveFlow bijector

tfb_masked_dense()

Autoregressively masked dense layer

tfb_matrix_inverse_tri_l()

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

tfb_matvec_lu()

Matrix-vector multiply using LU decomposition

tfb_normal_cdf()

ComputesY = g(X) = NormalCDF(x)

tfb_ordered()

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

tfb_pad()

Pads a value to the event_shape of a Tensor.

tfb_permute()

Permutes the rightmost dimension of a Tensor

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_real_nvp()

RealNVP affine coupling layer for vector-valued events

tfb_real_nvp_default_template()

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

tfb_reciprocal()

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

tfb_reshape()

Reshapes the event_shape of a Tensor

tfb_scale()

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

tfb_scale_matvec_diag()

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

tfb_scale_matvec_linear_operator()

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

tfb_scale_matvec_lu()

Matrix-vector multiply using LU decomposition.

tfb_scale_matvec_tri_l()

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

tfb_scale_tri_l()

Transforms unconstrained vectors to TriL matrices with positive diagonal

tfb_shift()

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

tfb_sigmoid()

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

tfb_sinh_arcsinh()

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

tfb_softmax_centered()

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

tfb_softplus()

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

tfb_softsign()

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

tfb_square()

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

tfb_tanh()

Computes Y = tanh(X)

tfb_transform_diagonal()

Applies a Bijector to the diagonal of a matrix

tfb_transpose()

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

tfb_weibull()

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

tfb_weibull_cdf()

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

Bijector methods

tfb_forward()

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

tfb_forward_log_det_jacobian()

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

tfb_inverse()

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

tfb_inverse_log_det_jacobian()

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

Variational inference

vi_amari_alpha()

The Amari-alpha Csiszar-function in log-space

vi_arithmetic_geometric()

The Arithmetic-Geometric Csiszar-function in log-space

vi_chi_square()

The chi-square 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

vi_fit_surrogate_posterior()

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

vi_jeffreys()

The Jeffreys Csiszar-function in log-space

vi_jensen_shannon()

The Jensen-Shannon Csiszar-function in log-space

vi_kl_forward()

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

vi_kl_reverse()

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

vi_log1p_abs()

The log1p-abs Csiszar-function in log-space

vi_modified_gan()

The Modified-GAN Csiszar-function in log-space

vi_monte_carlo_variational_loss()

Monte-Carlo approximation of an f-Divergence variational loss

vi_pearson()

The Pearson Csiszar-function in log-space

vi_squared_hellinger()

The Squared-Hellinger Csiszar-function in log-space

vi_symmetrized_csiszar_function()

Symmetrizes a Csiszar-function in log-space

MCMC kernels

mcmc_dual_averaging_step_size_adaptation()

Adapts the inner kernel's step_size based on log_accept_prob.

mcmc_hamiltonian_monte_carlo()

Runs one step of Hamiltonian Monte Carlo.

mcmc_metropolis_adjusted_langevin_algorithm()

Runs one step of Metropolis-adjusted Langevin algorithm.

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_random_walk_metropolis()

Runs one step of the RWM algorithm with symmetric proposal.

mcmc_replica_exchange_mc()

Runs one step of the Replica Exchange Monte Carlo

mcmc_simple_step_size_adaptation()

Adapts the inner kernel's step_size based on log_accept_prob.

mcmc_slice_sampler()

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

mcmc_transformed_transition_kernel()

Applies a bijector to the MCMC's state space

mcmc_uncalibrated_hamiltonian_monte_carlo()

Runs one step of Uncalibrated Hamiltonian Monte Carlo

mcmc_uncalibrated_langevin()

Runs one step of Uncalibrated Langevin discretized diffusion.

mcmc_uncalibrated_random_walk()

Generate proposal for the Random Walk Metropolis algorithm.

MCMC functions

mcmc_effective_sample_size()

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

mcmc_potential_scale_reduction()

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

mcmc_sample_annealed_importance_chain()

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

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.

Structural time series models

sts_additive_state_space_model()

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

sts_autoregressive()

Formal representation of an autoregressive model.

sts_autoregressive_state_space_model()

State space model for an autoregressive process.

sts_constrained_seasonal_state_space_model()

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

sts_dynamic_linear_regression()

Formal representation of a dynamic linear regression model.

sts_dynamic_linear_regression_state_space_model()

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

sts_linear_regression()

Formal representation of a linear regression from provided covariates.

sts_local_level()

Formal representation of a local level model

sts_local_level_state_space_model()

State space model for a local level

sts_local_linear_trend()

Formal representation of a local linear trend model

sts_local_linear_trend_state_space_model()

State space model for a local linear trend

sts_seasonal()

Formal representation of a seasonal effect model.

sts_seasonal_state_space_model()

State space model for a seasonal effect.

sts_semi_local_linear_trend()

Formal representation of a semi-local linear trend model.

sts_semi_local_linear_trend_state_space_model()

State space model for a semi-local linear trend.

sts_smooth_seasonal()

Formal representation of a smooth seasonal effect model

sts_smooth_seasonal_state_space_model()

State space model for a smooth seasonal effect

sts_sparse_linear_regression()

Formal representation of a sparse linear regression.

sts_sum()

Sum of structural time series components.

Structural time series modeling functions

sts_build_factored_surrogate_posterior()

Build a variational posterior that factors over model parameters.

sts_build_factored_variational_loss()

Build a loss function for variational inference in STS models.

sts_decompose_by_component()

Decompose an observed time series into contributions from each component.

sts_decompose_forecast_by_component()

Decompose a forecast distribution into contributions from each component.

sts_fit_with_hmc()

Draw posterior samples using Hamiltonian Monte Carlo (HMC)

sts_forecast()

Construct predictive distribution over future observations

sts_one_step_predictive()

Compute one-step-ahead predictive distributions for all timesteps

sts_sample_uniform_initial_state()

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

Generalized Linear Models

glm_families

GLM families

glm_fit(<tensorflow.tensor>)

Runs multiple Fisher scoring steps

glm_fit_one_step(<tensorflow.tensor>)

Runs one Fisher Scoring step