# LostTech.TensorFlow : API Documentation

Type VectorExponentialDiag

Namespace tensorflow.contrib.distributions

Interfaces IVectorExponentialDiag

The vectorization of the Exponential distribution on `R^k`.

The vector exponential distribution is defined over a subset of `R^k`, and parameterized by a (batch of) length-`k` `loc` vector 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 defined over the image of the `scale` matrix + `loc`, applied to the positive half-space: `Supp = {loc + scale @ x : x in R^k, x_1 > 0,..., x_k > 0}`. On this set,

```none pdf(y; loc, scale) = exp(-||x||_1) / Z, for y in Supp x = inv(scale) @ (y - loc), Z = |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, * `||x||_1` denotes the `l1` norm of `x`, `sum_i |x_i|`.

The VectorExponential 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 = (X_1,..., X_k), each X_i ~ Exponential(rate=1) Y = (Y_1,...,Y_k) = scale @ X + loc ```

#### About `VectorExponential` and `Vector` distributions in TensorFlow.

The `VectorExponential` is a non-standard distribution that has useful properties.

The marginals `Y_1,..., Y_k` are *not* Exponential random variables, due to the fact that the sum of Exponential random variables is not Exponential.

Instead, `Y` is a vector whose components are linear combinations of Exponential random variables. Thus, `Y` lives in the vector space generated by `vectors` of Exponential distributions. This allows the user to decide the mean and covariance (by setting `loc` and `scale`), while preserving some properties of the Exponential distribution. In particular, the tails of `Y_i` will be (up to polynomial factors) exponentially decaying.

To see this last statement, note that the pdf of `Y_i` is the convolution of the pdf of `k` independent Exponential random variables. One can then show by induction that distributions with exponential (up to polynomial factors) tails are closed under convolution.

#### Examples
Show Example
```import tensorflow_probability as tfp
tfd = tfp.distributions  # Initialize a single 2-variate VectorExponential, supported on
# {(x, y) in R^2 : x > 0, y > 0}.  # The first component has pdf exp{-x}, the second 0.5 exp{-x / 2}
vex = tfd.VectorExponentialDiag(scale_diag=[1., 2.])  # Compute the pdf of an`R^2` observation; return a scalar.
vex.prob([3., 4.]).eval()  # shape: []  # Initialize a 2-batch of 3-variate Vector Exponential's.
loc = [[1., 2, 3],
[1., 0, 0]]              # shape: [2, 3]
scale_diag = [[1., 2, 3],
[0.5, 1, 1.5]]     # shape: [2, 3]  vex = tfd.VectorExponentialDiag(loc, scale_diag)  # Compute the pdf of two `R^3` observations; return a length-2 vector.
x = [[1.9, 2.2, 3.1],
[10., 1.0, 9.0]]     # shape: [2, 3]
vex.prob(x).eval()    # shape: [2] ```