LostTech.TensorFlow : API Documentation

Type MultivariateNormalFullCovariance

Namespace tensorflow.contrib.distributions

Parent MultivariateNormalTriL

Interfaces IMultivariateNormalFullCovariance

The multivariate normal distribution on `R^k`.

The Multivariate Normal distribution is defined over `R^k` and parameterized by a (batch of) length-`k` `loc` vector (aka "mu") and a (batch of) `k x k` `covariance_matrix` matrices that are the covariance. This is different than the other multivariate normals, which are parameterized by a matrix more akin to the standard deviation.

#### Mathematical Details

The probability density function (pdf) is, with `@` as matrix multiplication,

```none pdf(x; loc, covariance_matrix) = exp(-0.5 y) / Z, y = (x - loc)^T @ inv(covariance_matrix) @ (x - loc) Z = (2 pi)**(0.5 k) |det(covariance_matrix)|**(0.5). ```

where:

* `loc` is a vector in `R^k`, * `covariance_matrix` is an `R^{k x k}` symmetric positive definite matrix, * `Z` denotes the normalization constant.

Additional leading dimensions (if any) in `loc` and `covariance_matrix` allow for batch dimensions.

The MultivariateNormal distribution is a member of the [location-scale family](https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be constructed e.g. as,

```none X ~ MultivariateNormal(loc=0, scale=1) # Identity scale, zero shift. scale = Cholesky(covariance_matrix) Y = scale @ X + loc ```

#### Examples
Show Example
import tensorflow_probability as tfp
            tfd = tfp.distributions 

# Initialize a single 3-variate Gaussian. mu = [1., 2, 3] cov = [[ 0.36, 0.12, 0.06], [ 0.12, 0.29, -0.13], [ 0.06, -0.13, 0.26]] mvn = tfd.MultivariateNormalFullCovariance( loc=mu, covariance_matrix=cov)

mvn.mean().eval() # ==> [1., 2, 3]

# Covariance agrees with covariance_matrix. mvn.covariance().eval() # ==> [[ 0.36, 0.12, 0.06], # [ 0.12, 0.29, -0.13], # [ 0.06, -0.13, 0.26]]

# Compute the pdf of an observation in `R^3` ; return a scalar. mvn.prob([-1., 0, 1]).eval() # shape: []

# Initialize a 2-batch of 3-variate Gaussians. mu = [[1., 2, 3], [11, 22, 33]] # shape: [2, 3] covariance_matrix =... # shape: [2, 3, 3], symmetric, positive definite. mvn = tfd.MultivariateNormalFullCovariance( loc=mu, covariance=covariance_matrix)

# Compute the pdf of two `R^3` observations; return a length-2 vector. x = [[-0.9, 0, 0.1], [-10, 0, 9]] # shape: [2, 3] mvn.prob(x).eval() # shape: [2]

Properties

Public properties

object allow_nan_stats get;

object allow_nan_stats_dyn get;

TensorShape batch_shape get;

object batch_shape_dyn get;

object bijector get;

object bijector_dyn get;

object distribution get;

object distribution_dyn get;

object dtype get;

object dtype_dyn get;

TensorShape event_shape get;

object event_shape_dyn get;

object loc get;

object loc_dyn get;

string name get;

object name_dyn get;

IDictionary<object, object> parameters get;

object parameters_dyn get;

object PythonObject get;

object reparameterization_type get;

object reparameterization_type_dyn get;

object scale get;

object scale_dyn get;

object validate_args get;

object validate_args_dyn get;