Type WishartCholesky
Namespace tensorflow.contrib.distributions
Parent _WishartLinearOperator
Interfaces IWishartCholesky
The matrix Wishart distribution on positive definite matrices. This distribution is defined by a scalar degrees of freedom `df` and a
lower, triangular Cholesky factor which characterizes the scale matrix. Using WishartCholesky is a constant-time improvement over WishartFull. It
saves an O(nbk^3) operation, i.e., a matrix-product operation for sampling
and a Cholesky factorization in log_prob. For most use-cases it often saves
another O(nbk^3) operation since most uses of Wishart will also use the
Cholesky factorization. #### Mathematical Details The probability density function (pdf) is, ```none
pdf(X; df, scale) = det(X)**(0.5 (df-k-1)) exp(-0.5 tr[inv(scale) X]) / Z
Z = 2**(0.5 df k) |det(scale)|**(0.5 df) Gamma_k(0.5 df)
``` where:
* `df >= k` denotes the degrees of freedom,
* `scale` is a symmetric, positive definite, `k x k` matrix,
* `Z` is the normalizing constant, and,
* `Gamma_k` is the [multivariate Gamma function](
https://en.wikipedia.org/wiki/Multivariate_gamma_function). #### Examples
Show Example
import tensorflow_probability as tfp tfd = tfp.distributions # Initialize a single 3x3 Wishart with Cholesky factored scale matrix and 5 # degrees-of-freedom.(*) df = 5 chol_scale = tf.linalg.cholesky(...) # Shape is [3, 3]. dist = tfd.WishartCholesky(df=df, scale=chol_scale) # Evaluate this on an observation in R^3, returning a scalar. x =... # A 3x3 positive definite matrix. dist.prob(x) # Shape is [], a scalar. # Evaluate this on a two observations, each in R^{3x3}, returning a length two # Tensor. x = [x0, x1] # Shape is [2, 3, 3]. dist.prob(x) # Shape is [2]. # Initialize two 3x3 Wisharts with Cholesky factored scale matrices. df = [5, 4] chol_scale = tf.linalg.cholesky(...) # Shape is [2, 3, 3]. dist = tfd.WishartCholesky(df=df, scale=chol_scale) # Evaluate this on four observations. x = [[x0, x1], [x2, x3]] # Shape is [2, 2, 3, 3]. dist.prob(x) # Shape is [2, 2]. # (*) - To efficiently create a trainable covariance matrix, see the example # in tfp.distributions.matrix_diag_transform.
Properties
- allow_nan_stats
- allow_nan_stats_dyn
- batch_shape
- batch_shape_dyn
- cholesky_input_output_matrices
- cholesky_input_output_matrices_dyn
- df
- df_dyn
- dimension
- dimension_dyn
- dtype
- dtype_dyn
- event_shape
- event_shape_dyn
- name
- name_dyn
- parameters
- parameters_dyn
- PythonObject
- reparameterization_type
- reparameterization_type_dyn
- scale_operator
- scale_operator_dyn
- validate_args
- validate_args_dyn