LostTech.TensorFlow : API Documentation

Type WishartFull

Namespace tensorflow.contrib.distributions

Parent _WishartLinearOperator

Interfaces IWishartFull

The matrix Wishart distribution on positive definite matrices.

This distribution is defined by a scalar degrees of freedom `df` and a symmetric, positive definite scale matrix.

Evaluation of the pdf, determinant, and sampling are all `O(k^3)` operations where `(k, k)` is the event space shape.

#### 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 Full factored scale matrix and 5
# degrees-of-freedom.(*)
df = 5
scale =...  # Shape is [3, 3]; positive definite.
dist = tfd.WishartFull(df=df, scale=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 Full factored scale matrices.
df = [5, 4]
scale =...  # Shape is [2, 3, 3].
dist = tfd.WishartFull(df=df, scale=scale)  # Evaluate this on four observations.
x = [[x0, x1], [x2, x3]]  # Shape is [2, 2, 3, 3]; xi is positive definite.
dist.prob(x)  # Shape is [2, 2].  # (*) - To efficiently create a trainable covariance matrix, see the example
#   in tfd.matrix_diag_transform. ```