LostTech.TensorFlow : API Documentation

Type MultivariateNormalDiag

Namespace tensorflow.contrib.distributions

Parent MultivariateNormalLinearOperator

Interfaces IMultivariateNormalDiag

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` `scale` matrix; `covariance = scale @ scale.T` where `@` denotes matrix-multiplication.

#### Mathematical Details

The probability density function (pdf) is,

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

where:

* `loc` is a vector in `R^k`, * `scale` is a linear operator in `R^{k x k}`, `cov = scale @ scale.T`, * `Z` denotes the normalization constant, and, * `||y||**2` denotes the squared Euclidean norm of `y`.

A (non-batch) `scale` matrix is:

```none scale = diag(scale_diag + scale_identity_multiplier * ones(k)) ```

where:

* `scale_diag.shape = [k]`, and, * `scale_identity_multiplier.shape = []`.

Additional leading dimensions (if any) will index batches.

If both `scale_diag` and `scale_identity_multiplier` are `None`, then `scale` is the Identity matrix.

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 as,

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

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

# Initialize a single 2-variate Gaussian. mvn = tfd.MultivariateNormalDiag( loc=[1., -1], scale_diag=[1, 2.])

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

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

# Evaluate this on an observation in `R^2`, returning a scalar. mvn.prob([-1., 0]).eval() # shape: []

# Initialize a 3-batch, 2-variate scaled-identity Gaussian. mvn = tfd.MultivariateNormalDiag( loc=[1., -1], scale_identity_multiplier=[1, 2., 3])

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

mvn.stddev().eval() # shape: [3, 2] # ==> [[1., 1], # [2, 2], # [3, 3]]

# Evaluate this on an observation in `R^2`, returning a length-3 vector. mvn.prob([-1., 0]).eval() # shape: [3]

# Initialize a 2-batch of 3-variate Gaussians. mvn = tfd.MultivariateNormalDiag( loc=[[1., 2, 3], [11, 22, 33]] # shape: [2, 3] scale_diag=[[1., 2, 3], [0.5, 1, 1.5]]) # shape: [2, 3]

# Evaluate this on a two observations, each in `R^3`, returning a length-2 # vector. x = [[-1., 0, 1], [-11, 0, 11.]] # 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;