Update generated Python Op docs.
Change: 147193332
This commit is contained in:
parent
e8f70a32cf
commit
44b4b734e6
@ -112,7 +112,7 @@ specified then `scale += IdentityMatrix`. Otherwise specifying a
|
||||
* <b>`shift`</b>: Numeric `Tensor`. If this is set to `None`, no shift is applied.
|
||||
* <b>`scale_identity_multiplier`</b>: floating point rank 0 `Tensor` representing a
|
||||
scaling done to the identity matrix.
|
||||
When `scale_identity_multiplier = scale_diag=scale_tril = None` then
|
||||
When `scale_identity_multiplier = scale_diag = scale_tril = None` then
|
||||
`scale += IdentityMatrix`. Otherwise no scaled-identity-matrix is added
|
||||
to `scale`.
|
||||
* <b>`scale_diag`</b>: Numeric `Tensor` representing the diagonal matrix.
|
||||
@ -405,14 +405,14 @@ Returns the string name of this `Bijector`.
|
||||
|
||||
#### `tf.contrib.distributions.bijector.Affine.scale` {#Affine.scale}
|
||||
|
||||
|
||||
The `scale` `LinearOperator` in `Y = scale @ X + shift`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.bijector.Affine.shift` {#Affine.shift}
|
||||
|
||||
|
||||
The `shift` `Tensor` in `Y = scale @ X + shift`.
|
||||
|
||||
|
||||
- - -
|
||||
@ -427,7 +427,7 @@ Returns True if Tensor arguments will be validated.
|
||||
|
||||
### `class tf.contrib.distributions.bijector.AffineLinearOperator` {#AffineLinearOperator}
|
||||
|
||||
Compute `Y = g(X; shift, scale) = scale(X.T) + shift`.
|
||||
Compute `Y = g(X; shift, scale) = scale @ X + shift`.
|
||||
|
||||
`shift` is a numeric `Tensor` and `scale` is a `LinearOperator`.
|
||||
|
||||
@ -467,7 +467,7 @@ diag = [1., 2, 3]
|
||||
scale = linalg.LinearOperatorDiag(diag)
|
||||
affine = AffineLinearOperator(shift, scale)
|
||||
# In this case, `forward` is equivalent to:
|
||||
# diag * scale + shift
|
||||
# y = scale @ x + shift
|
||||
y = affine.forward(x) # [0., 4, 10]
|
||||
|
||||
shift = [2., 3, 1]
|
||||
@ -767,14 +767,14 @@ Returns the string name of this `Bijector`.
|
||||
|
||||
#### `tf.contrib.distributions.bijector.AffineLinearOperator.scale` {#AffineLinearOperator.scale}
|
||||
|
||||
The `scale` `LinearOperator` in `Y = scale @ X.T + shift`.
|
||||
The `scale` `LinearOperator` in `Y = scale @ X + shift`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.bijector.AffineLinearOperator.shift` {#AffineLinearOperator.shift}
|
||||
|
||||
The `shift` `Tensor` in `Y = scale @ X.T + shift`.
|
||||
The `shift` `Tensor` in `Y = scale @ X + shift`.
|
||||
|
||||
|
||||
- - -
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -778,6 +778,13 @@ Determinant for every batch member.
|
||||
* <b>`NotImplementedError`</b>: If `self.is_square` is `False`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.linalg.LinearOperatorDiag.diag` {#LinearOperatorDiag.diag}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.linalg.LinearOperatorDiag.domain_dimension` {#LinearOperatorDiag.domain_dimension}
|
||||
|
@ -1,676 +0,0 @@
|
||||
The multivariate normal distribution on `R^k`.
|
||||
|
||||
This distribution is defined by a 1-D mean `mu` and a Cholesky factor `chol`.
|
||||
Providing the Cholesky factor allows for `O(k^2)` pdf evaluation and sampling,
|
||||
and requires `O(k^2)` storage.
|
||||
|
||||
#### Mathematical details
|
||||
|
||||
The Cholesky factor `chol` defines the covariance matrix: `C = chol chol^T`.
|
||||
|
||||
The PDF of this distribution is then:
|
||||
|
||||
```
|
||||
f(x) = (2 pi)^(-k/2) |det(C)|^(-1/2) exp(-1/2 (x - mu)^T C^{-1} (x - mu))
|
||||
```
|
||||
|
||||
#### Examples
|
||||
|
||||
A single multi-variate Gaussian distribution is defined by a vector of means
|
||||
of length `k`, and a covariance matrix of shape `k x k`.
|
||||
|
||||
Extra leading dimensions, if provided, allow for batches.
|
||||
|
||||
```python
|
||||
# Initialize a single 3-variate Gaussian with diagonal covariance.
|
||||
# Note, this would be more efficient with MultivariateNormalDiag.
|
||||
mu = [1, 2, 3.]
|
||||
chol = [[1, 0, 0], [0, 3, 0], [0, 0, 2]]
|
||||
dist = tf.contrib.distributions.MultivariateNormalCholesky(mu, chol)
|
||||
|
||||
# Evaluate this on an observation in R^3, returning a scalar.
|
||||
dist.pdf([-1, 0, 1])
|
||||
|
||||
# Initialize a batch of two 3-variate Gaussians.
|
||||
mu = [[1, 2, 3], [11, 22, 33]]
|
||||
chol = ... # shape 2 x 3 x 3, lower triangular, positive diagonal.
|
||||
dist = tf.contrib.distributions.MultivariateNormalCholesky(mu, chol)
|
||||
|
||||
# Evaluate this on a two observations, each in R^3, returning a length two
|
||||
# tensor.
|
||||
x = [[-1, 0, 1], [-11, 0, 11]] # Shape 2 x 3.
|
||||
dist.pdf(x)
|
||||
```
|
||||
|
||||
Trainable (batch) Cholesky matrices can be created with
|
||||
`tf.contrib.distributions.matrix_diag_transform()`
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.__init__(mu, chol, validate_args=False, allow_nan_stats=True, name='MultivariateNormalCholesky')` {#MultivariateNormalCholesky.__init__}
|
||||
|
||||
Multivariate Normal distributions on `R^k`.
|
||||
|
||||
User must provide means `mu` and `chol` which holds the (batch) Cholesky
|
||||
factors, such that the covariance of each batch member is `chol chol^T`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`mu`</b>: `(N+1)-D` floating point tensor with shape `[N1,...,Nb, k]`,
|
||||
`b >= 0`.
|
||||
* <b>`chol`</b>: `(N+2)-D` `Tensor` with same `dtype` as `mu` and shape
|
||||
`[N1,...,Nb, k, k]`. The upper triangular part is ignored (treated as
|
||||
though it is zero), and the diagonal must be positive.
|
||||
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to validate input
|
||||
with asserts. If `validate_args` is `False`, and the inputs are
|
||||
invalid, correct behavior is not guaranteed.
|
||||
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an
|
||||
exception if a statistic (e.g. mean/mode/etc...) is undefined for any
|
||||
batch member If `True`, batch members with valid parameters leading to
|
||||
undefined statistics will return NaN for this statistic.
|
||||
* <b>`name`</b>: The name to give Ops created by the initializer.
|
||||
|
||||
##### Raises:
|
||||
|
||||
|
||||
* <b>`TypeError`</b>: If `mu` and `chol` are different dtypes.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.allow_nan_stats` {#MultivariateNormalCholesky.allow_nan_stats}
|
||||
|
||||
Python boolean describing behavior when a stat is undefined.
|
||||
|
||||
Stats return +/- infinity when it makes sense. E.g., the variance
|
||||
of a Cauchy distribution is infinity. However, sometimes the
|
||||
statistic is undefined, e.g., if a distribution's pdf does not achieve a
|
||||
maximum within the support of the distribution, the mode is undefined.
|
||||
If the mean is undefined, then by definition the variance is undefined.
|
||||
E.g. the mean for Student's T for df = 1 is undefined (no clear way to say
|
||||
it is either + or - infinity), so the variance = E[(X - mean)^2] is also
|
||||
undefined.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`allow_nan_stats`</b>: Python boolean.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.batch_shape` {#MultivariateNormalCholesky.batch_shape}
|
||||
|
||||
Shape of a single sample from a single event index as a `TensorShape`.
|
||||
|
||||
May be partially defined or unknown.
|
||||
|
||||
The batch dimensions are indexes into independent, non-identical
|
||||
parameterizations of this distribution.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`batch_shape`</b>: `TensorShape`, possibly unknown.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalCholesky.batch_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single event index as a 1-D `Tensor`.
|
||||
|
||||
The batch dimensions are indexes into independent, non-identical
|
||||
parameterizations of this distribution.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: name to give to the op
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`batch_shape`</b>: `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.cdf(value, name='cdf')` {#MultivariateNormalCholesky.cdf}
|
||||
|
||||
Cumulative distribution function.
|
||||
|
||||
Given random variable `X`, the cumulative distribution function `cdf` is:
|
||||
|
||||
```
|
||||
cdf(x) := P[X <= x]
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`cdf`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.copy(**override_parameters_kwargs)` {#MultivariateNormalCholesky.copy}
|
||||
|
||||
Creates a deep copy of the distribution.
|
||||
|
||||
Note: the copy distribution may continue to depend on the original
|
||||
intialization arguments.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`**override_parameters_kwargs`</b>: String/value dictionary of initialization
|
||||
arguments to override with new values.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`distribution`</b>: A new instance of `type(self)` intitialized from the union
|
||||
of self.parameters and override_parameters_kwargs, i.e.,
|
||||
`dict(self.parameters, **override_parameters_kwargs)`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.covariance(name='covariance')` {#MultivariateNormalCholesky.covariance}
|
||||
|
||||
Covariance.
|
||||
|
||||
Covariance is (possibly) defined only for non-scalar-event distributions.
|
||||
|
||||
For example, for a length-`k`, vector-valued distribution, it is calculated
|
||||
as,
|
||||
|
||||
```none
|
||||
Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])]
|
||||
```
|
||||
|
||||
where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E`
|
||||
denotes expectation.
|
||||
|
||||
Alternatively, for non-vector, multivariate distributions (e.g.,
|
||||
matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices
|
||||
under some vectorization of the events, i.e.,
|
||||
|
||||
```none
|
||||
Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above]
|
||||
````
|
||||
|
||||
where `Cov` is a (batch of) `k' x k'` matrices,
|
||||
`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function
|
||||
mapping indices of this distribution's event dimensions to indices of a
|
||||
length-`k'` vector.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`covariance`</b>: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']`
|
||||
where the first `n` dimensions are batch coordinates and
|
||||
`k' = reduce_prod(self.event_shape)`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.dtype` {#MultivariateNormalCholesky.dtype}
|
||||
|
||||
The `DType` of `Tensor`s handled by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.entropy(name='entropy')` {#MultivariateNormalCholesky.entropy}
|
||||
|
||||
Shannon entropy in nats.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.event_shape` {#MultivariateNormalCholesky.event_shape}
|
||||
|
||||
Shape of a single sample from a single batch as a `TensorShape`.
|
||||
|
||||
May be partially defined or unknown.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`event_shape`</b>: `TensorShape`, possibly unknown.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalCholesky.event_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: name to give to the op
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`event_shape`</b>: `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.is_continuous` {#MultivariateNormalCholesky.is_continuous}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalCholesky.is_scalar_batch}
|
||||
|
||||
Indicates that `batch_shape == []`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`is_scalar_batch`</b>: `Boolean` `scalar` `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalCholesky.is_scalar_event}
|
||||
|
||||
Indicates that `event_shape == []`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`is_scalar_event`</b>: `Boolean` `scalar` `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.log_cdf(value, name='log_cdf')` {#MultivariateNormalCholesky.log_cdf}
|
||||
|
||||
Log cumulative distribution function.
|
||||
|
||||
Given random variable `X`, the cumulative distribution function `cdf` is:
|
||||
|
||||
```
|
||||
log_cdf(x) := Log[ P[X <= x] ]
|
||||
```
|
||||
|
||||
Often, a numerical approximation can be used for `log_cdf(x)` that yields
|
||||
a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
`x << -1`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`logcdf`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.log_prob(value, name='log_prob')` {#MultivariateNormalCholesky.log_prob}
|
||||
|
||||
Log probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`log_prob`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.log_sigma_det(name='log_sigma_det')` {#MultivariateNormalCholesky.log_sigma_det}
|
||||
|
||||
Log of determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalCholesky.log_survival_function}
|
||||
|
||||
Log survival function.
|
||||
|
||||
Given random variable `X`, the survival function is defined:
|
||||
|
||||
```
|
||||
log_survival_function(x) = Log[ P[X > x] ]
|
||||
= Log[ 1 - P[X <= x] ]
|
||||
= Log[ 1 - cdf(x) ]
|
||||
```
|
||||
|
||||
Typically, different numerical approximations can be used for the log
|
||||
survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type
|
||||
`self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.mean(name='mean')` {#MultivariateNormalCholesky.mean}
|
||||
|
||||
Mean.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.mode(name='mode')` {#MultivariateNormalCholesky.mode}
|
||||
|
||||
Mode.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.mu` {#MultivariateNormalCholesky.mu}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.name` {#MultivariateNormalCholesky.name}
|
||||
|
||||
Name prepended to all ops created by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalCholesky.param_shapes}
|
||||
|
||||
Shapes of parameters given the desired shape of a call to `sample()`.
|
||||
|
||||
This is a class method that describes what key/value arguments are required
|
||||
to instantiate the given `Distribution` so that a particular shape is
|
||||
returned for that instance's call to `sample()`.
|
||||
|
||||
Subclasses should override class method `_param_shapes`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`sample_shape`</b>: `Tensor` or python list/tuple. Desired shape of a call to
|
||||
`sample()`.
|
||||
* <b>`name`</b>: name to prepend ops with.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`dict` of parameter name to `Tensor` shapes.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.param_static_shapes(cls, sample_shape)` {#MultivariateNormalCholesky.param_static_shapes}
|
||||
|
||||
param_shapes with static (i.e. `TensorShape`) shapes.
|
||||
|
||||
This is a class method that describes what key/value arguments are required
|
||||
to instantiate the given `Distribution` so that a particular shape is
|
||||
returned for that instance's call to `sample()`. Assumes that
|
||||
the sample's shape is known statically.
|
||||
|
||||
Subclasses should override class method `_param_shapes` to return
|
||||
constant-valued tensors when constant values are fed.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`sample_shape`</b>: `TensorShape` or python list/tuple. Desired shape of a call
|
||||
to `sample()`.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`dict` of parameter name to `TensorShape`.
|
||||
|
||||
##### Raises:
|
||||
|
||||
|
||||
* <b>`ValueError`</b>: if `sample_shape` is a `TensorShape` and is not fully defined.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.parameters` {#MultivariateNormalCholesky.parameters}
|
||||
|
||||
Dictionary of parameters used to instantiate this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.prob(value, name='prob')` {#MultivariateNormalCholesky.prob}
|
||||
|
||||
Probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`prob`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.reparameterization_type` {#MultivariateNormalCholesky.reparameterization_type}
|
||||
|
||||
Describes how samples from the distribution are reparameterized.
|
||||
|
||||
Currently this is one of the static instances
|
||||
`distributions.FULLY_REPARAMETERIZED`
|
||||
or `distributions.NOT_REPARAMETERIZED`.
|
||||
|
||||
##### Returns:
|
||||
|
||||
An instance of `ReparameterizationType`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalCholesky.sample}
|
||||
|
||||
Generate samples of the specified shape.
|
||||
|
||||
Note that a call to `sample()` without arguments will generate a single
|
||||
sample.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`sample_shape`</b>: 0D or 1D `int32` `Tensor`. Shape of the generated samples.
|
||||
* <b>`seed`</b>: Python integer seed for RNG
|
||||
* <b>`name`</b>: name to give to the op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`samples`</b>: a `Tensor` with prepended dimensions `sample_shape`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.sigma` {#MultivariateNormalCholesky.sigma}
|
||||
|
||||
Dense (batch) covariance matrix, if available.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.sigma_det(name='sigma_det')` {#MultivariateNormalCholesky.sigma_det}
|
||||
|
||||
Determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.stddev(name='stddev')` {#MultivariateNormalCholesky.stddev}
|
||||
|
||||
Standard deviation.
|
||||
|
||||
Standard deviation is defined as,
|
||||
|
||||
```none
|
||||
stddev = E[(X - E[X])**2]**0.5
|
||||
```
|
||||
|
||||
where `X` is the random variable associated with this distribution, `E`
|
||||
denotes expectation, and `stddev.shape = batch_shape + event_shape`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`stddev`</b>: Floating-point `Tensor` with shape identical to
|
||||
`batch_shape + event_shape`, i.e., the same shape as `self.mean()`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.survival_function(value, name='survival_function')` {#MultivariateNormalCholesky.survival_function}
|
||||
|
||||
Survival function.
|
||||
|
||||
Given random variable `X`, the survival function is defined:
|
||||
|
||||
```
|
||||
survival_function(x) = P[X > x]
|
||||
= 1 - P[X <= x]
|
||||
= 1 - cdf(x).
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type
|
||||
`self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.validate_args` {#MultivariateNormalCholesky.validate_args}
|
||||
|
||||
Python boolean indicated possibly expensive checks are enabled.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalCholesky.variance(name='variance')` {#MultivariateNormalCholesky.variance}
|
||||
|
||||
Variance.
|
||||
|
||||
Variance is defined as,
|
||||
|
||||
```none
|
||||
Var = E[(X - E[X])**2]
|
||||
```
|
||||
|
||||
where `X` is the random variable associated with this distribution, `E`
|
||||
denotes expectation, and `Var.shape = batch_shape + event_shape`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`variance`</b>: Floating-point `Tensor` with shape identical to
|
||||
`batch_shape + event_shape`, i.e., the same shape as `self.mean()`.
|
||||
|
||||
|
@ -382,15 +382,6 @@ a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
|
||||
Log probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `TransformedDistribution`:
|
||||
|
||||
Implements `(log o p o g^{-1})(y) + (log o abs o det o J o g^{-1})(y)`,
|
||||
where `g^{-1}` is the inverse of `transform`.
|
||||
|
||||
Also raises a `ValueError` if `inverse` was not provided to the
|
||||
distribution and `y` was not returned from `sample`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
@ -521,15 +512,6 @@ Dictionary of parameters used to instantiate this `Distribution`.
|
||||
|
||||
Probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `TransformedDistribution`:
|
||||
|
||||
Implements `p(g^{-1}(y)) det|J(g^{-1}(y))|`, where `g^{-1}` is the
|
||||
inverse of `transform`.
|
||||
|
||||
Also raises a `ValueError` if `inverse` was not provided to the
|
||||
distribution and `y` was not returned from `sample`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
|
@ -228,6 +228,13 @@ Determinant for every batch member.
|
||||
* <b>`NotImplementedError`</b>: If `self.is_square` is `False`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.linalg.LinearOperatorDiag.diag` {#LinearOperatorDiag.diag}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.linalg.LinearOperatorDiag.domain_dimension` {#LinearOperatorDiag.domain_dimension}
|
||||
|
@ -1,79 +1,162 @@
|
||||
The multivariate normal distribution on `R^k`.
|
||||
|
||||
This distribution is defined by a 1-D mean `mu` and a 1-D diagonal
|
||||
`diag_stddev`, representing the standard deviations. This distribution
|
||||
assumes the random variables, `(X_1,...,X_k)` are independent, thus no
|
||||
non-diagonal terms of the covariance matrix are needed.
|
||||
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.
|
||||
|
||||
This allows for `O(k)` pdf evaluation, sampling, and storage.
|
||||
#### Mathematical Details
|
||||
|
||||
#### Mathematical details
|
||||
|
||||
The PDF of this distribution is defined in terms of the diagonal covariance
|
||||
determined by `diag_stddev`: `C_{ii} = diag_stddev[i]**2`.
|
||||
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)|,
|
||||
```
|
||||
f(x) = (2 pi)^(-k/2) |det(C)|^(-1/2) exp(-1/2 (x - mu)^T C^{-1} (x - mu))
|
||||
|
||||
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
|
||||
|
||||
A single multi-variate Gaussian distribution is defined by a vector of means
|
||||
of length `k`, and the square roots of the (independent) random variables.
|
||||
|
||||
Extra leading dimensions, if provided, allow for batches.
|
||||
|
||||
```python
|
||||
# Initialize a single 3-variate Gaussian with diagonal standard deviation.
|
||||
mu = [1, 2, 3.]
|
||||
diag_stddev = [4, 5, 6.]
|
||||
dist = tf.contrib.distributions.MultivariateNormalDiag(mu, diag_stddev)
|
||||
ds = tf.contrib.distributions
|
||||
|
||||
# Evaluate this on an observation in R^3, returning a scalar.
|
||||
dist.pdf([-1, 0, 1])
|
||||
# Initialize a single 2-variate Gaussian.
|
||||
mvn = ds.MultivariateNormalDiag(
|
||||
loc=[1., -1],
|
||||
scale_diag=[1, 2.])
|
||||
|
||||
# Initialize a batch of two 3-variate Gaussians.
|
||||
mu = [[1, 2, 3], [11, 22, 33]] # shape 2 x 3
|
||||
diag_stddev = ... # shape 2 x 3, positive.
|
||||
dist = tf.contrib.distributions.MultivariateNormalDiag(mu, diag_stddev)
|
||||
mvn.mean().eval()
|
||||
# ==> [1., -1]
|
||||
|
||||
# Evaluate this on a two observations, each in R^3, returning a length two
|
||||
# tensor.
|
||||
x = [[-1, 0, 1], [-11, 0, 11]] # Shape 2 x 3.
|
||||
dist.pdf(x)
|
||||
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 = ds.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 = ds.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]
|
||||
```
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.__init__(mu, diag_stddev, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiag')` {#MultivariateNormalDiag.__init__}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.__init__(loc=None, scale_diag=None, scale_identity_multiplier=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiag')` {#MultivariateNormalDiag.__init__}
|
||||
|
||||
Multivariate Normal distributions on `R^k`.
|
||||
Construct Multivariate Normal distribution on `R^k`.
|
||||
|
||||
User must provide means `mu` and standard deviations `diag_stddev`.
|
||||
Each batch member represents a random vector `(X_1,...,X_k)` of independent
|
||||
random normals.
|
||||
The mean of `X_i` is `mu[i]`, and the standard deviation is
|
||||
`diag_stddev[i]`.
|
||||
The `batch_shape` is the broadcast shape between `loc` and `scale`
|
||||
arguments.
|
||||
|
||||
The `event_shape` is given by the last dimension of `loc` or the last
|
||||
dimension of the matrix implied by `scale`.
|
||||
|
||||
Recall that `covariance = scale @ scale.T`. 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.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`mu`</b>: Rank `N + 1` floating point tensor with shape `[N1,...,Nb, k]`,
|
||||
`b >= 0`.
|
||||
* <b>`diag_stddev`</b>: Rank `N + 1` `Tensor` with same `dtype` and shape as `mu`,
|
||||
representing the standard deviations. Must be positive.
|
||||
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to validate
|
||||
input with asserts. If `validate_args` is `False`,
|
||||
and the inputs are invalid, correct behavior is not guaranteed.
|
||||
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an
|
||||
exception if a statistic (e.g. mean/mode/etc...) is undefined for any
|
||||
batch member If `True`, batch members with valid parameters leading to
|
||||
undefined statistics will return NaN for this statistic.
|
||||
* <b>`name`</b>: The name to give Ops created by the initializer.
|
||||
* <b>`loc`</b>: Floating-point `Tensor`. If this is set to `None`, `loc` is
|
||||
implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where
|
||||
`b >= 0` and `k` represents the event size.
|
||||
* <b>`scale_diag`</b>: Non-zero, floating-point `Tensor` representing a diagonal
|
||||
matrix added to `scale`. May have shape `[B1, ..., Bb, k]`, `b >= 0`,
|
||||
and characterizes `b`-batches of `k x k` diagonal matrices added to
|
||||
`scale`. When both `scale_identity_multiplier` and `scale_diag` are
|
||||
`None` then `scale` is the `Identity`.
|
||||
* <b>`scale_identity_multiplier`</b>: Non-zero, floating-point `Tensor` representing
|
||||
a scaled-identity-matrix added to `scale`. May have shape
|
||||
`[B1, ..., Bb]`, `b >= 0`, and characterizes `b`-batches of scaled
|
||||
`k x k` identity matrices added to `scale`. When both
|
||||
`scale_identity_multiplier` and `scale_diag` are `None` then `scale` is
|
||||
the `Identity`.
|
||||
* <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
|
||||
parameters are checked for validity despite possibly degrading runtime
|
||||
performance. When `False` invalid inputs may silently render incorrect
|
||||
outputs.
|
||||
* <b>`allow_nan_stats`</b>: Python `Boolean`, default `True`. When `True`,
|
||||
statistics (e.g., mean, mode, variance) use the value "`NaN`" to
|
||||
indicate the result is undefined. When `False`, an exception is raised
|
||||
if one or more of the statistic's batch members are undefined.
|
||||
* <b>`name`</b>: `String` name prefixed to Ops created by this class.
|
||||
|
||||
##### Raises:
|
||||
|
||||
|
||||
* <b>`TypeError`</b>: If `mu` and `diag_stddev` are different dtypes.
|
||||
* <b>`ValueError`</b>: if at most `scale_identity_multiplier` is specified.
|
||||
|
||||
|
||||
- - -
|
||||
@ -134,6 +217,13 @@ parameterizations of this distribution.
|
||||
* <b>`batch_shape`</b>: `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.bijector` {#MultivariateNormalDiag.bijector}
|
||||
|
||||
Function transforming x => y.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.cdf(value, name='cdf')` {#MultivariateNormalDiag.cdf}
|
||||
@ -226,6 +316,20 @@ length-`k'` vector.
|
||||
`k' = reduce_prod(self.event_shape)`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.det_covariance(name='det_covariance')` {#MultivariateNormalDiag.det_covariance}
|
||||
|
||||
Determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.distribution` {#MultivariateNormalDiag.distribution}
|
||||
|
||||
Base distribution, p(x).
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.dtype` {#MultivariateNormalDiag.dtype}
|
||||
@ -312,6 +416,13 @@ Indicates that `event_shape == []`.
|
||||
* <b>`is_scalar_event`</b>: `Boolean` `scalar` `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.loc` {#MultivariateNormalDiag.loc}
|
||||
|
||||
The `loc` `Tensor` in `Y = scale @ X + loc`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiag.log_cdf}
|
||||
@ -341,6 +452,13 @@ a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalDiag.log_det_covariance}
|
||||
|
||||
Log of determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.log_prob(value, name='log_prob')` {#MultivariateNormalDiag.log_prob}
|
||||
@ -348,19 +466,19 @@ a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
Log probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
Additional documentation from `_MultivariateNormalLinearOperator`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
`value` is a batch vector with compatible shape if `value` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
```python
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```python
|
||||
[M1, ..., Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
@ -376,13 +494,6 @@ or
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.log_sigma_det(name='log_sigma_det')` {#MultivariateNormalDiag.log_sigma_det}
|
||||
|
||||
Log of determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiag.log_survival_function}
|
||||
@ -426,13 +537,6 @@ Mean.
|
||||
Mode.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.mu` {#MultivariateNormalDiag.mu}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.name` {#MultivariateNormalDiag.name}
|
||||
@ -508,19 +612,19 @@ Dictionary of parameters used to instantiate this `Distribution`.
|
||||
Probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
Additional documentation from `_MultivariateNormalLinearOperator`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
`value` is a batch vector with compatible shape if `value` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
```python
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```python
|
||||
[M1, ..., Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
@ -575,16 +679,9 @@ sample.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.sigma` {#MultivariateNormalDiag.sigma}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.scale` {#MultivariateNormalDiag.scale}
|
||||
|
||||
Dense (batch) covariance matrix, if available.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiag.sigma_det(name='sigma_det')` {#MultivariateNormalDiag.sigma_det}
|
||||
|
||||
Determinant of covariance matrix.
|
||||
The `scale` `LinearOperator` in `Y = scale @ X + loc`.
|
||||
|
||||
|
||||
- - -
|
||||
|
@ -1,14 +1,14 @@
|
||||
MultivariateNormalDiag with `diag_stddev = softplus(diag_stddev)`.
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.__init__(mu, diag_stddev, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiagWithSoftplusStdDev')` {#MultivariateNormalDiagWithSoftplusStDev.__init__}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.__init__(loc, scale_diag, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiagWithSoftplusScale')` {#MultivariateNormalDiagWithSoftplusScale.__init__}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.allow_nan_stats` {#MultivariateNormalDiagWithSoftplusStDev.allow_nan_stats}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.allow_nan_stats` {#MultivariateNormalDiagWithSoftplusScale.allow_nan_stats}
|
||||
|
||||
Python boolean describing behavior when a stat is undefined.
|
||||
|
||||
@ -29,7 +29,7 @@ undefined.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.batch_shape` {#MultivariateNormalDiagWithSoftplusStDev.batch_shape}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.batch_shape` {#MultivariateNormalDiagWithSoftplusScale.batch_shape}
|
||||
|
||||
Shape of a single sample from a single event index as a `TensorShape`.
|
||||
|
||||
@ -46,7 +46,7 @@ parameterizations of this distribution.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiagWithSoftplusStDev.batch_shape_tensor}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiagWithSoftplusScale.batch_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single event index as a 1-D `Tensor`.
|
||||
|
||||
@ -66,7 +66,14 @@ parameterizations of this distribution.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.cdf(value, name='cdf')` {#MultivariateNormalDiagWithSoftplusStDev.cdf}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.bijector` {#MultivariateNormalDiagWithSoftplusScale.bijector}
|
||||
|
||||
Function transforming x => y.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.cdf(value, name='cdf')` {#MultivariateNormalDiagWithSoftplusScale.cdf}
|
||||
|
||||
Cumulative distribution function.
|
||||
|
||||
@ -91,7 +98,7 @@ cdf(x) := P[X <= x]
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.copy(**override_parameters_kwargs)` {#MultivariateNormalDiagWithSoftplusStDev.copy}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.copy(**override_parameters_kwargs)` {#MultivariateNormalDiagWithSoftplusScale.copy}
|
||||
|
||||
Creates a deep copy of the distribution.
|
||||
|
||||
@ -114,7 +121,7 @@ intialization arguments.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.covariance(name='covariance')` {#MultivariateNormalDiagWithSoftplusStDev.covariance}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.covariance(name='covariance')` {#MultivariateNormalDiagWithSoftplusScale.covariance}
|
||||
|
||||
Covariance.
|
||||
|
||||
@ -158,21 +165,35 @@ length-`k'` vector.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.dtype` {#MultivariateNormalDiagWithSoftplusStDev.dtype}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.det_covariance(name='det_covariance')` {#MultivariateNormalDiagWithSoftplusScale.det_covariance}
|
||||
|
||||
Determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.distribution` {#MultivariateNormalDiagWithSoftplusScale.distribution}
|
||||
|
||||
Base distribution, p(x).
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.dtype` {#MultivariateNormalDiagWithSoftplusScale.dtype}
|
||||
|
||||
The `DType` of `Tensor`s handled by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.entropy(name='entropy')` {#MultivariateNormalDiagWithSoftplusStDev.entropy}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.entropy(name='entropy')` {#MultivariateNormalDiagWithSoftplusScale.entropy}
|
||||
|
||||
Shannon entropy in nats.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.event_shape` {#MultivariateNormalDiagWithSoftplusStDev.event_shape}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.event_shape` {#MultivariateNormalDiagWithSoftplusScale.event_shape}
|
||||
|
||||
Shape of a single sample from a single batch as a `TensorShape`.
|
||||
|
||||
@ -186,7 +207,7 @@ May be partially defined or unknown.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiagWithSoftplusStDev.event_shape_tensor}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiagWithSoftplusScale.event_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
|
||||
|
||||
@ -203,14 +224,14 @@ Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.is_continuous` {#MultivariateNormalDiagWithSoftplusStDev.is_continuous}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.is_continuous` {#MultivariateNormalDiagWithSoftplusScale.is_continuous}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiagWithSoftplusStDev.is_scalar_batch}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiagWithSoftplusScale.is_scalar_batch}
|
||||
|
||||
Indicates that `batch_shape == []`.
|
||||
|
||||
@ -227,7 +248,7 @@ Indicates that `batch_shape == []`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiagWithSoftplusStDev.is_scalar_event}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiagWithSoftplusScale.is_scalar_event}
|
||||
|
||||
Indicates that `event_shape == []`.
|
||||
|
||||
@ -244,7 +265,14 @@ Indicates that `event_shape == []`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiagWithSoftplusStDev.log_cdf}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.loc` {#MultivariateNormalDiagWithSoftplusScale.loc}
|
||||
|
||||
The `loc` `Tensor` in `Y = scale @ X + loc`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiagWithSoftplusScale.log_cdf}
|
||||
|
||||
Log cumulative distribution function.
|
||||
|
||||
@ -273,24 +301,31 @@ a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.log_prob(value, name='log_prob')` {#MultivariateNormalDiagWithSoftplusStDev.log_prob}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalDiagWithSoftplusScale.log_det_covariance}
|
||||
|
||||
Log of determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_prob(value, name='log_prob')` {#MultivariateNormalDiagWithSoftplusScale.log_prob}
|
||||
|
||||
Log probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
Additional documentation from `_MultivariateNormalLinearOperator`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
`value` is a batch vector with compatible shape if `value` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
```python
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```python
|
||||
[M1, ..., Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
@ -308,14 +343,7 @@ or
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.log_sigma_det(name='log_sigma_det')` {#MultivariateNormalDiagWithSoftplusStDev.log_sigma_det}
|
||||
|
||||
Log of determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiagWithSoftplusStDev.log_survival_function}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiagWithSoftplusScale.log_survival_function}
|
||||
|
||||
Log survival function.
|
||||
|
||||
@ -344,35 +372,28 @@ survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.mean(name='mean')` {#MultivariateNormalDiagWithSoftplusStDev.mean}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.mean(name='mean')` {#MultivariateNormalDiagWithSoftplusScale.mean}
|
||||
|
||||
Mean.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.mode(name='mode')` {#MultivariateNormalDiagWithSoftplusStDev.mode}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.mode(name='mode')` {#MultivariateNormalDiagWithSoftplusScale.mode}
|
||||
|
||||
Mode.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.mu` {#MultivariateNormalDiagWithSoftplusStDev.mu}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.name` {#MultivariateNormalDiagWithSoftplusStDev.name}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.name` {#MultivariateNormalDiagWithSoftplusScale.name}
|
||||
|
||||
Name prepended to all ops created by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiagWithSoftplusStDev.param_shapes}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiagWithSoftplusScale.param_shapes}
|
||||
|
||||
Shapes of parameters given the desired shape of a call to `sample()`.
|
||||
|
||||
@ -396,7 +417,7 @@ Subclasses should override class method `_param_shapes`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiagWithSoftplusStDev.param_static_shapes}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiagWithSoftplusScale.param_static_shapes}
|
||||
|
||||
param_shapes with static (i.e. `TensorShape`) shapes.
|
||||
|
||||
@ -426,31 +447,31 @@ constant-valued tensors when constant values are fed.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.parameters` {#MultivariateNormalDiagWithSoftplusStDev.parameters}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.parameters` {#MultivariateNormalDiagWithSoftplusScale.parameters}
|
||||
|
||||
Dictionary of parameters used to instantiate this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.prob(value, name='prob')` {#MultivariateNormalDiagWithSoftplusStDev.prob}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.prob(value, name='prob')` {#MultivariateNormalDiagWithSoftplusScale.prob}
|
||||
|
||||
Probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
Additional documentation from `_MultivariateNormalLinearOperator`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
`value` is a batch vector with compatible shape if `value` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
```python
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```python
|
||||
[M1, ..., Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
@ -468,7 +489,7 @@ or
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.reparameterization_type` {#MultivariateNormalDiagWithSoftplusStDev.reparameterization_type}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.reparameterization_type` {#MultivariateNormalDiagWithSoftplusScale.reparameterization_type}
|
||||
|
||||
Describes how samples from the distribution are reparameterized.
|
||||
|
||||
@ -483,7 +504,7 @@ or `distributions.NOT_REPARAMETERIZED`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiagWithSoftplusStDev.sample}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiagWithSoftplusScale.sample}
|
||||
|
||||
Generate samples of the specified shape.
|
||||
|
||||
@ -505,21 +526,14 @@ sample.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.sigma` {#MultivariateNormalDiagWithSoftplusStDev.sigma}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.scale` {#MultivariateNormalDiagWithSoftplusScale.scale}
|
||||
|
||||
Dense (batch) covariance matrix, if available.
|
||||
The `scale` `LinearOperator` in `Y = scale @ X + loc`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.sigma_det(name='sigma_det')` {#MultivariateNormalDiagWithSoftplusStDev.sigma_det}
|
||||
|
||||
Determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.stddev(name='stddev')` {#MultivariateNormalDiagWithSoftplusStDev.stddev}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.stddev(name='stddev')` {#MultivariateNormalDiagWithSoftplusScale.stddev}
|
||||
|
||||
Standard deviation.
|
||||
|
||||
@ -546,7 +560,7 @@ denotes expectation, and `stddev.shape = batch_shape + event_shape`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.survival_function(value, name='survival_function')` {#MultivariateNormalDiagWithSoftplusStDev.survival_function}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.survival_function(value, name='survival_function')` {#MultivariateNormalDiagWithSoftplusScale.survival_function}
|
||||
|
||||
Survival function.
|
||||
|
||||
@ -572,14 +586,14 @@ survival_function(x) = P[X > x]
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.validate_args` {#MultivariateNormalDiagWithSoftplusStDev.validate_args}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.validate_args` {#MultivariateNormalDiagWithSoftplusScale.validate_args}
|
||||
|
||||
Python boolean indicated possibly expensive checks are enabled.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev.variance(name='variance')` {#MultivariateNormalDiagWithSoftplusStDev.variance}
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.variance(name='variance')` {#MultivariateNormalDiagWithSoftplusScale.variance}
|
||||
|
||||
Variance.
|
||||
|
@ -77,7 +77,7 @@ distribution:
|
||||
```python
|
||||
ds = tf.contrib.distributions
|
||||
log_normal = ds.TransformedDistribution(
|
||||
distribution=ds.Normal(mu=mu, sigma=sigma),
|
||||
distribution=ds.Normal(loc=mu, scale=sigma),
|
||||
bijector=ds.bijector.Exp(),
|
||||
name="LogNormalTransformedDistribution")
|
||||
```
|
||||
@ -87,7 +87,7 @@ A `LogNormal` made from callables:
|
||||
```python
|
||||
ds = tf.contrib.distributions
|
||||
log_normal = ds.TransformedDistribution(
|
||||
distribution=ds.Normal(mu=mu, sigma=sigma),
|
||||
distribution=ds.Normal(loc=mu, scale=sigma),
|
||||
bijector=ds.bijector.Inline(
|
||||
forward_fn=tf.exp,
|
||||
inverse_fn=tf.log,
|
||||
@ -101,7 +101,7 @@ Another example constructing a Normal from a StandardNormal:
|
||||
```python
|
||||
ds = tf.contrib.distributions
|
||||
normal = ds.TransformedDistribution(
|
||||
distribution=ds.Normal(mu=0, sigma=1),
|
||||
distribution=ds.Normal(loc=0, scale=1),
|
||||
bijector=ds.bijector.ScaleAndShift(loc=mu, scale=sigma, event_ndims=0),
|
||||
name="NormalTransformedDistribution")
|
||||
```
|
||||
@ -125,11 +125,11 @@ chol_cov = [[[1., 0],
|
||||
[[1, 0],
|
||||
[2, 2]]] # batch:1
|
||||
mvn1 = ds.TransformedDistribution(
|
||||
distribution=ds.Normal(mu=0., sigma=1.),
|
||||
distribution=ds.Normal(loc=0., scale=1.),
|
||||
bijector=bs.Affine(shift=mean, tril=chol_cov),
|
||||
batch_shape=[2], # Valid because base_distribution.batch_shape == [].
|
||||
event_shape=[2]) # Valid because base_distribution.event_shape == [].
|
||||
mvn2 = ds.MultivariateNormalCholesky(mu=mean, chol=chol_cov)
|
||||
mvn2 = ds.MultivariateNormalTriL(loc=mean, scale_tril=chol_cov)
|
||||
# mvn1.log_prob(x) == mvn2.log_prob(x)
|
||||
```
|
||||
- - -
|
||||
@ -442,15 +442,6 @@ a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
|
||||
Log probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `TransformedDistribution`:
|
||||
|
||||
Implements `(log o p o g^{-1})(y) + (log o abs o det o J o g^{-1})(y)`,
|
||||
where `g^{-1}` is the inverse of `transform`.
|
||||
|
||||
Also raises a `ValueError` if `inverse` was not provided to the
|
||||
distribution and `y` was not returned from `sample`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
@ -581,15 +572,6 @@ Dictionary of parameters used to instantiate this `Distribution`.
|
||||
|
||||
Probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `TransformedDistribution`:
|
||||
|
||||
Implements `p(g^{-1}(y)) det|J(g^{-1}(y))|`, where `g^{-1}` is the
|
||||
inverse of `transform`.
|
||||
|
||||
Also raises a `ValueError` if `inverse` was not provided to the
|
||||
distribution and `y` was not returned from `sample`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
|
@ -1,702 +0,0 @@
|
||||
The multivariate normal distribution on `R^k`.
|
||||
|
||||
Every batch member of this distribution is defined by a mean and a lightweight
|
||||
covariance matrix `C`.
|
||||
|
||||
#### Mathematical details
|
||||
|
||||
The PDF of this distribution in terms of the mean `mu` and covariance `C` is:
|
||||
|
||||
```
|
||||
f(x) = (2 pi)^(-k/2) |det(C)|^(-1/2) exp(-1/2 (x - mu)^T C^{-1} (x - mu))
|
||||
```
|
||||
|
||||
For every batch member, this distribution represents `k` random variables
|
||||
`(X_1,...,X_k)`, with mean `E[X_i] = mu[i]`, and covariance matrix
|
||||
`C_{ij} := E[(X_i - mu[i])(X_j - mu[j])]`
|
||||
|
||||
The user initializes this class by providing the mean `mu`, and a lightweight
|
||||
definition of `C`:
|
||||
|
||||
```
|
||||
C = SS^T = SS = (M + V D V^T) (M + V D V^T)
|
||||
M is diagonal (k x k)
|
||||
V = is shape (k x r), typically r << k
|
||||
D = is diagonal (r x r), optional (defaults to identity).
|
||||
```
|
||||
|
||||
This allows for `O(kr + r^3)` pdf evaluation and determinant, and `O(kr)`
|
||||
sampling and storage (per batch member).
|
||||
|
||||
#### Examples
|
||||
|
||||
A single multi-variate Gaussian distribution is defined by a vector of means
|
||||
of length `k`, and square root of the covariance `S = M + V D V^T`. Extra
|
||||
leading dimensions, if provided, allow for batches.
|
||||
|
||||
```python
|
||||
# Initialize a single 3-variate Gaussian with covariance square root
|
||||
# S = M + V D V^T, where V D V^T is a matrix-rank 2 update.
|
||||
mu = [1, 2, 3.]
|
||||
diag_large = [1.1, 2.2, 3.3]
|
||||
v = ... # shape 3 x 2
|
||||
diag_small = [4., 5.]
|
||||
dist = tf.contrib.distributions.MultivariateNormalDiagPlusVDVT(
|
||||
mu, diag_large, v, diag_small=diag_small)
|
||||
|
||||
# Evaluate this on an observation in R^3, returning a scalar.
|
||||
dist.pdf([-1, 0, 1])
|
||||
|
||||
# Initialize a batch of two 3-variate Gaussians. This time, don't provide
|
||||
# diag_small. This means S = M + V V^T.
|
||||
mu = [[1, 2, 3], [11, 22, 33]] # shape 2 x 3
|
||||
diag_large = ... # shape 2 x 3
|
||||
v = ... # shape 2 x 3 x 1, a matrix-rank 1 update.
|
||||
dist = tf.contrib.distributions.MultivariateNormalDiagPlusVDVT(
|
||||
mu, diag_large, v)
|
||||
|
||||
# Evaluate this on a two observations, each in R^3, returning a length two
|
||||
# tensor.
|
||||
x = [[-1, 0, 1], [-11, 0, 11]] # Shape 2 x 3.
|
||||
dist.pdf(x)
|
||||
```
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.__init__(mu, diag_large, v, diag_small=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiagPlusVDVT')` {#MultivariateNormalDiagPlusVDVT.__init__}
|
||||
|
||||
Multivariate Normal distributions on `R^k`.
|
||||
|
||||
For every batch member, this distribution represents `k` random variables
|
||||
`(X_1,...,X_k)`, with mean `E[X_i] = mu[i]`, and covariance matrix
|
||||
`C_{ij} := E[(X_i - mu[i])(X_j - mu[j])]`
|
||||
|
||||
The user initializes this class by providing the mean `mu`, and a
|
||||
lightweight definition of `C`:
|
||||
|
||||
```
|
||||
C = SS^T = SS = (M + V D V^T) (M + V D V^T)
|
||||
M is diagonal (k x k)
|
||||
V = is shape (k x r), typically r << k
|
||||
D = is diagonal (r x r), optional (defaults to identity).
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`mu`</b>: Rank `n + 1` floating point tensor with shape `[N1,...,Nn, k]`,
|
||||
`n >= 0`. The means.
|
||||
* <b>`diag_large`</b>: Optional rank `n + 1` floating point tensor, shape
|
||||
`[N1,...,Nn, k]` `n >= 0`. Defines the diagonal matrix `M`.
|
||||
* <b>`v`</b>: Rank `n + 1` floating point tensor, shape `[N1,...,Nn, k, r]`
|
||||
`n >= 0`. Defines the matrix `V`.
|
||||
* <b>`diag_small`</b>: Rank `n + 1` floating point tensor, shape
|
||||
`[N1,...,Nn, k]` `n >= 0`. Defines the diagonal matrix `D`. Default
|
||||
is `None`, which means `D` will be the identity matrix.
|
||||
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to validate input
|
||||
with asserts. If `validate_args` is `False`,
|
||||
and the inputs are invalid, correct behavior is not guaranteed.
|
||||
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an
|
||||
exception if a statistic (e.g. mean/mode/etc...) is undefined for any
|
||||
batch member If `True`, batch members with valid parameters leading to
|
||||
undefined statistics will return NaN for this statistic.
|
||||
* <b>`name`</b>: The name to give Ops created by the initializer.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.allow_nan_stats` {#MultivariateNormalDiagPlusVDVT.allow_nan_stats}
|
||||
|
||||
Python boolean describing behavior when a stat is undefined.
|
||||
|
||||
Stats return +/- infinity when it makes sense. E.g., the variance
|
||||
of a Cauchy distribution is infinity. However, sometimes the
|
||||
statistic is undefined, e.g., if a distribution's pdf does not achieve a
|
||||
maximum within the support of the distribution, the mode is undefined.
|
||||
If the mean is undefined, then by definition the variance is undefined.
|
||||
E.g. the mean for Student's T for df = 1 is undefined (no clear way to say
|
||||
it is either + or - infinity), so the variance = E[(X - mean)^2] is also
|
||||
undefined.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`allow_nan_stats`</b>: Python boolean.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.batch_shape` {#MultivariateNormalDiagPlusVDVT.batch_shape}
|
||||
|
||||
Shape of a single sample from a single event index as a `TensorShape`.
|
||||
|
||||
May be partially defined or unknown.
|
||||
|
||||
The batch dimensions are indexes into independent, non-identical
|
||||
parameterizations of this distribution.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`batch_shape`</b>: `TensorShape`, possibly unknown.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiagPlusVDVT.batch_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single event index as a 1-D `Tensor`.
|
||||
|
||||
The batch dimensions are indexes into independent, non-identical
|
||||
parameterizations of this distribution.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: name to give to the op
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`batch_shape`</b>: `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.cdf(value, name='cdf')` {#MultivariateNormalDiagPlusVDVT.cdf}
|
||||
|
||||
Cumulative distribution function.
|
||||
|
||||
Given random variable `X`, the cumulative distribution function `cdf` is:
|
||||
|
||||
```
|
||||
cdf(x) := P[X <= x]
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`cdf`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.copy(**override_parameters_kwargs)` {#MultivariateNormalDiagPlusVDVT.copy}
|
||||
|
||||
Creates a deep copy of the distribution.
|
||||
|
||||
Note: the copy distribution may continue to depend on the original
|
||||
intialization arguments.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`**override_parameters_kwargs`</b>: String/value dictionary of initialization
|
||||
arguments to override with new values.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`distribution`</b>: A new instance of `type(self)` intitialized from the union
|
||||
of self.parameters and override_parameters_kwargs, i.e.,
|
||||
`dict(self.parameters, **override_parameters_kwargs)`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.covariance(name='covariance')` {#MultivariateNormalDiagPlusVDVT.covariance}
|
||||
|
||||
Covariance.
|
||||
|
||||
Covariance is (possibly) defined only for non-scalar-event distributions.
|
||||
|
||||
For example, for a length-`k`, vector-valued distribution, it is calculated
|
||||
as,
|
||||
|
||||
```none
|
||||
Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])]
|
||||
```
|
||||
|
||||
where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E`
|
||||
denotes expectation.
|
||||
|
||||
Alternatively, for non-vector, multivariate distributions (e.g.,
|
||||
matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices
|
||||
under some vectorization of the events, i.e.,
|
||||
|
||||
```none
|
||||
Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above]
|
||||
````
|
||||
|
||||
where `Cov` is a (batch of) `k' x k'` matrices,
|
||||
`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function
|
||||
mapping indices of this distribution's event dimensions to indices of a
|
||||
length-`k'` vector.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`covariance`</b>: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']`
|
||||
where the first `n` dimensions are batch coordinates and
|
||||
`k' = reduce_prod(self.event_shape)`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.dtype` {#MultivariateNormalDiagPlusVDVT.dtype}
|
||||
|
||||
The `DType` of `Tensor`s handled by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.entropy(name='entropy')` {#MultivariateNormalDiagPlusVDVT.entropy}
|
||||
|
||||
Shannon entropy in nats.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.event_shape` {#MultivariateNormalDiagPlusVDVT.event_shape}
|
||||
|
||||
Shape of a single sample from a single batch as a `TensorShape`.
|
||||
|
||||
May be partially defined or unknown.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`event_shape`</b>: `TensorShape`, possibly unknown.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiagPlusVDVT.event_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: name to give to the op
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`event_shape`</b>: `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.is_continuous` {#MultivariateNormalDiagPlusVDVT.is_continuous}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiagPlusVDVT.is_scalar_batch}
|
||||
|
||||
Indicates that `batch_shape == []`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`is_scalar_batch`</b>: `Boolean` `scalar` `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiagPlusVDVT.is_scalar_event}
|
||||
|
||||
Indicates that `event_shape == []`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`is_scalar_event`</b>: `Boolean` `scalar` `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiagPlusVDVT.log_cdf}
|
||||
|
||||
Log cumulative distribution function.
|
||||
|
||||
Given random variable `X`, the cumulative distribution function `cdf` is:
|
||||
|
||||
```
|
||||
log_cdf(x) := Log[ P[X <= x] ]
|
||||
```
|
||||
|
||||
Often, a numerical approximation can be used for `log_cdf(x)` that yields
|
||||
a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
`x << -1`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`logcdf`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.log_prob(value, name='log_prob')` {#MultivariateNormalDiagPlusVDVT.log_prob}
|
||||
|
||||
Log probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`log_prob`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.log_sigma_det(name='log_sigma_det')` {#MultivariateNormalDiagPlusVDVT.log_sigma_det}
|
||||
|
||||
Log of determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiagPlusVDVT.log_survival_function}
|
||||
|
||||
Log survival function.
|
||||
|
||||
Given random variable `X`, the survival function is defined:
|
||||
|
||||
```
|
||||
log_survival_function(x) = Log[ P[X > x] ]
|
||||
= Log[ 1 - P[X <= x] ]
|
||||
= Log[ 1 - cdf(x) ]
|
||||
```
|
||||
|
||||
Typically, different numerical approximations can be used for the log
|
||||
survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type
|
||||
`self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.mean(name='mean')` {#MultivariateNormalDiagPlusVDVT.mean}
|
||||
|
||||
Mean.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.mode(name='mode')` {#MultivariateNormalDiagPlusVDVT.mode}
|
||||
|
||||
Mode.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.mu` {#MultivariateNormalDiagPlusVDVT.mu}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.name` {#MultivariateNormalDiagPlusVDVT.name}
|
||||
|
||||
Name prepended to all ops created by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiagPlusVDVT.param_shapes}
|
||||
|
||||
Shapes of parameters given the desired shape of a call to `sample()`.
|
||||
|
||||
This is a class method that describes what key/value arguments are required
|
||||
to instantiate the given `Distribution` so that a particular shape is
|
||||
returned for that instance's call to `sample()`.
|
||||
|
||||
Subclasses should override class method `_param_shapes`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`sample_shape`</b>: `Tensor` or python list/tuple. Desired shape of a call to
|
||||
`sample()`.
|
||||
* <b>`name`</b>: name to prepend ops with.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`dict` of parameter name to `Tensor` shapes.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiagPlusVDVT.param_static_shapes}
|
||||
|
||||
param_shapes with static (i.e. `TensorShape`) shapes.
|
||||
|
||||
This is a class method that describes what key/value arguments are required
|
||||
to instantiate the given `Distribution` so that a particular shape is
|
||||
returned for that instance's call to `sample()`. Assumes that
|
||||
the sample's shape is known statically.
|
||||
|
||||
Subclasses should override class method `_param_shapes` to return
|
||||
constant-valued tensors when constant values are fed.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`sample_shape`</b>: `TensorShape` or python list/tuple. Desired shape of a call
|
||||
to `sample()`.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`dict` of parameter name to `TensorShape`.
|
||||
|
||||
##### Raises:
|
||||
|
||||
|
||||
* <b>`ValueError`</b>: if `sample_shape` is a `TensorShape` and is not fully defined.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.parameters` {#MultivariateNormalDiagPlusVDVT.parameters}
|
||||
|
||||
Dictionary of parameters used to instantiate this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.prob(value, name='prob')` {#MultivariateNormalDiagPlusVDVT.prob}
|
||||
|
||||
Probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`prob`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.reparameterization_type` {#MultivariateNormalDiagPlusVDVT.reparameterization_type}
|
||||
|
||||
Describes how samples from the distribution are reparameterized.
|
||||
|
||||
Currently this is one of the static instances
|
||||
`distributions.FULLY_REPARAMETERIZED`
|
||||
or `distributions.NOT_REPARAMETERIZED`.
|
||||
|
||||
##### Returns:
|
||||
|
||||
An instance of `ReparameterizationType`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiagPlusVDVT.sample}
|
||||
|
||||
Generate samples of the specified shape.
|
||||
|
||||
Note that a call to `sample()` without arguments will generate a single
|
||||
sample.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`sample_shape`</b>: 0D or 1D `int32` `Tensor`. Shape of the generated samples.
|
||||
* <b>`seed`</b>: Python integer seed for RNG
|
||||
* <b>`name`</b>: name to give to the op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`samples`</b>: a `Tensor` with prepended dimensions `sample_shape`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.sigma` {#MultivariateNormalDiagPlusVDVT.sigma}
|
||||
|
||||
Dense (batch) covariance matrix, if available.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.sigma_det(name='sigma_det')` {#MultivariateNormalDiagPlusVDVT.sigma_det}
|
||||
|
||||
Determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.stddev(name='stddev')` {#MultivariateNormalDiagPlusVDVT.stddev}
|
||||
|
||||
Standard deviation.
|
||||
|
||||
Standard deviation is defined as,
|
||||
|
||||
```none
|
||||
stddev = E[(X - E[X])**2]**0.5
|
||||
```
|
||||
|
||||
where `X` is the random variable associated with this distribution, `E`
|
||||
denotes expectation, and `stddev.shape = batch_shape + event_shape`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`stddev`</b>: Floating-point `Tensor` with shape identical to
|
||||
`batch_shape + event_shape`, i.e., the same shape as `self.mean()`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.survival_function(value, name='survival_function')` {#MultivariateNormalDiagPlusVDVT.survival_function}
|
||||
|
||||
Survival function.
|
||||
|
||||
Given random variable `X`, the survival function is defined:
|
||||
|
||||
```
|
||||
survival_function(x) = P[X > x]
|
||||
= 1 - P[X <= x]
|
||||
= 1 - cdf(x).
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type
|
||||
`self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.validate_args` {#MultivariateNormalDiagPlusVDVT.validate_args}
|
||||
|
||||
Python boolean indicated possibly expensive checks are enabled.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT.variance(name='variance')` {#MultivariateNormalDiagPlusVDVT.variance}
|
||||
|
||||
Variance.
|
||||
|
||||
Variance is defined as,
|
||||
|
||||
```none
|
||||
Var = E[(X - E[X])**2]
|
||||
```
|
||||
|
||||
where `X` is the random variable associated with this distribution, `E`
|
||||
denotes expectation, and `Var.shape = batch_shape + event_shape`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`variance`</b>: Floating-point `Tensor` with shape identical to
|
||||
`batch_shape + event_shape`, i.e., the same shape as `self.mean()`.
|
||||
|
||||
|
@ -86,7 +86,7 @@ specified then `scale += IdentityMatrix`. Otherwise specifying a
|
||||
* <b>`shift`</b>: Numeric `Tensor`. If this is set to `None`, no shift is applied.
|
||||
* <b>`scale_identity_multiplier`</b>: floating point rank 0 `Tensor` representing a
|
||||
scaling done to the identity matrix.
|
||||
When `scale_identity_multiplier = scale_diag=scale_tril = None` then
|
||||
When `scale_identity_multiplier = scale_diag = scale_tril = None` then
|
||||
`scale += IdentityMatrix`. Otherwise no scaled-identity-matrix is added
|
||||
to `scale`.
|
||||
* <b>`scale_diag`</b>: Numeric `Tensor` representing the diagonal matrix.
|
||||
@ -379,14 +379,14 @@ Returns the string name of this `Bijector`.
|
||||
|
||||
#### `tf.contrib.distributions.bijector.Affine.scale` {#Affine.scale}
|
||||
|
||||
|
||||
The `scale` `LinearOperator` in `Y = scale @ X + shift`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.bijector.Affine.shift` {#Affine.shift}
|
||||
|
||||
|
||||
The `shift` `Tensor` in `Y = scale @ X + shift`.
|
||||
|
||||
|
||||
- - -
|
||||
|
@ -1,4 +1,4 @@
|
||||
Compute `Y = g(X; shift, scale) = scale(X.T) + shift`.
|
||||
Compute `Y = g(X; shift, scale) = scale @ X + shift`.
|
||||
|
||||
`shift` is a numeric `Tensor` and `scale` is a `LinearOperator`.
|
||||
|
||||
@ -38,7 +38,7 @@ diag = [1., 2, 3]
|
||||
scale = linalg.LinearOperatorDiag(diag)
|
||||
affine = AffineLinearOperator(shift, scale)
|
||||
# In this case, `forward` is equivalent to:
|
||||
# diag * scale + shift
|
||||
# y = scale @ x + shift
|
||||
y = affine.forward(x) # [0., 4, 10]
|
||||
|
||||
shift = [2., 3, 1]
|
||||
@ -338,14 +338,14 @@ Returns the string name of this `Bijector`.
|
||||
|
||||
#### `tf.contrib.distributions.bijector.AffineLinearOperator.scale` {#AffineLinearOperator.scale}
|
||||
|
||||
The `scale` `LinearOperator` in `Y = scale @ X.T + shift`.
|
||||
The `scale` `LinearOperator` in `Y = scale @ X + shift`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.bijector.AffineLinearOperator.shift` {#AffineLinearOperator.shift}
|
||||
|
||||
The `shift` `Tensor` in `Y = scale @ X.T + shift`.
|
||||
The `shift` `Tensor` in `Y = scale @ X + shift`.
|
||||
|
||||
|
||||
- - -
|
||||
|
@ -0,0 +1,793 @@
|
||||
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)) +
|
||||
scale_perturb_factor @ diag(scale_perturb_diag) @ scale_perturb_factor.T
|
||||
```
|
||||
|
||||
where:
|
||||
|
||||
* `scale_diag.shape = [k]`,
|
||||
* `scale_identity_multiplier.shape = []`,
|
||||
* `scale_perturb_factor.shape = [k, r]`, typically `k >> r`, and,
|
||||
* `scale_perturb_diag.shape = [r]`.
|
||||
|
||||
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
|
||||
|
||||
```python
|
||||
ds = tf.contrib.distributions
|
||||
|
||||
# Initialize a single 3-variate Gaussian with covariance `cov = S @ S.T`,
|
||||
# `S = diag(d) + U @ diag(m) @ U.T`. The perturbation, `U @ diag(m) @ U.T`, is
|
||||
# a rank-2 update.
|
||||
mu = [-0.5., 0, 0.5] # shape: [3]
|
||||
d = [1.5, 0.5, 2] # shape: [3]
|
||||
U = [[1., 2],
|
||||
[-1, 1],
|
||||
[2, -0.5]] # shape: [3, 2]
|
||||
m = [4., 5] # shape: [2]
|
||||
mvn = ds.MultivariateNormalDiagPlusLowRank(
|
||||
loc=mu
|
||||
scale_diag=d
|
||||
scale_perturb_factor=U,
|
||||
scale_perturb_diag=m)
|
||||
|
||||
# Evaluate this on an observation in `R^3`, returning a scalar.
|
||||
mvn.prob([-1, 0, 1]).eval() # shape: []
|
||||
|
||||
# Initialize a 2-batch of 3-variate Gaussians; `S = diag(d) + U @ U.T`.
|
||||
mu = [[1., 2, 3],
|
||||
[11, 22, 33]] # shape: [b, k] = [2, 3]
|
||||
U = [[[1., 2],
|
||||
[3, 4],
|
||||
[5, 6]],
|
||||
[[0.5, 0.75],
|
||||
[1,0, 0.25],
|
||||
[1.5, 1.25]]] # shape: [b, k, r] = [2, 3, 2]
|
||||
m = [[0.1, 0.2],
|
||||
[0.4, 0.5]] # shape: [b, r] = [2, 2]
|
||||
|
||||
mvn = ds.MultivariateNormalDiagPlusLowRank(
|
||||
loc=mu,
|
||||
scale_perturb_factor=U,
|
||||
scale_perturb_diag=m)
|
||||
|
||||
mvn.covariance().eval() # shape: [2, 3, 3]
|
||||
# ==> [[[ 15.63 31.57 48.51]
|
||||
# [ 31.57 69.31 105.05]
|
||||
# [ 48.51 105.05 162.59]]
|
||||
#
|
||||
# [[ 2.59 1.41 3.35]
|
||||
# [ 1.41 2.71 3.34]
|
||||
# [ 3.35 3.34 8.35]]]
|
||||
|
||||
# Compute the pdf of two `R^3` observations (one from each batch);
|
||||
# return a length-2 vector.
|
||||
x = [[-0.9, 0, 0.1],
|
||||
[-10, 0, 9]] # shape: [2, 3]
|
||||
mvn.prob(x).eval() # shape: [2]
|
||||
```
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.__init__(loc=None, scale_diag=None, scale_identity_multiplier=None, scale_perturb_factor=None, scale_perturb_diag=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiagPlusLowRank')` {#MultivariateNormalDiagPlusLowRank.__init__}
|
||||
|
||||
Construct Multivariate Normal distribution on `R^k`.
|
||||
|
||||
The `batch_shape` is the broadcast shape between `loc` and `scale`
|
||||
arguments.
|
||||
|
||||
The `event_shape` is given by the last dimension of `loc` or the last
|
||||
dimension of the matrix implied by `scale`.
|
||||
|
||||
Recall that `covariance = scale @ scale.T`. A (non-batch) `scale` matrix is:
|
||||
|
||||
```none
|
||||
scale = diag(scale_diag + scale_identity_multiplier ones(k)) +
|
||||
scale_perturb_factor @ diag(scale_perturb_diag) @ scale_perturb_factor.T
|
||||
```
|
||||
|
||||
where:
|
||||
|
||||
* `scale_diag.shape = [k]`,
|
||||
* `scale_identity_multiplier.shape = []`,
|
||||
* `scale_perturb_factor.shape = [k, r]`, typically `k >> r`, and,
|
||||
* `scale_perturb_diag.shape = [r]`.
|
||||
|
||||
Additional leading dimensions (if any) will index batches.
|
||||
|
||||
If both `scale_diag` and `scale_identity_multiplier` are `None`, then
|
||||
`scale` is the Identity matrix.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`loc`</b>: Floating-point `Tensor`. If this is set to `None`, `loc` is
|
||||
implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where
|
||||
`b >= 0` and `k` represents the event size.
|
||||
* <b>`scale_diag`</b>: Non-zero, floating-point `Tensor` representing a diagonal
|
||||
matrix added to `scale`. May have shape `[B1, ..., Bb, k]`, `b >= 0`,
|
||||
and characterizes `b`-batches of `k x k` diagonal matrices added to
|
||||
`scale`. When both `scale_identity_multiplier` and `scale_diag` are
|
||||
`None` then `scale` is the `Identity`.
|
||||
* <b>`scale_identity_multiplier`</b>: Non-zero, floating-point `Tensor` representing
|
||||
a scaled-identity-matrix added to `scale`. May have shape
|
||||
`[B1, ..., Bb]`, `b >= 0`, and characterizes `b`-batches of scaled
|
||||
`k x k` identity matrices added to `scale`. When both
|
||||
`scale_identity_multiplier` and `scale_diag` are `None` then `scale` is
|
||||
the `Identity`.
|
||||
* <b>`scale_perturb_factor`</b>: Floating-point `Tensor` representing a rank-`r`
|
||||
perturbation added to `scale`. May have shape `[B1, ..., Bb, k, r]`,
|
||||
`b >= 0`, and characterizes `b`-batches of rank-`r` updates to `scale`.
|
||||
When `None`, no rank-`r` update is added to `scale`.
|
||||
* <b>`scale_perturb_diag`</b>: Floating-point `Tensor` representing a diagonal matrix
|
||||
inside the rank-`r` perturbation added to `scale`. May have shape
|
||||
`[B1, ..., Bb, r]`, `b >= 0`, and characterizes `b`-batches of `r x r`
|
||||
diagonal matrices inside the perturbation added to `scale`. When
|
||||
`None`, an identity matrix is used inside the perturbation. Can only be
|
||||
specified if `scale_perturb_factor` is also specified.
|
||||
* <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
|
||||
parameters are checked for validity despite possibly degrading runtime
|
||||
performance. When `False` invalid inputs may silently render incorrect
|
||||
outputs.
|
||||
* <b>`allow_nan_stats`</b>: Python `Boolean`, default `True`. When `True`,
|
||||
statistics (e.g., mean, mode, variance) use the value "`NaN`" to
|
||||
indicate the result is undefined. When `False`, an exception is raised
|
||||
if one or more of the statistic's batch members are undefined.
|
||||
* <b>`name`</b>: `String` name prefixed to Ops created by this class.
|
||||
|
||||
##### Raises:
|
||||
|
||||
|
||||
* <b>`ValueError`</b>: if at most `scale_identity_multiplier` is specified.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.allow_nan_stats` {#MultivariateNormalDiagPlusLowRank.allow_nan_stats}
|
||||
|
||||
Python boolean describing behavior when a stat is undefined.
|
||||
|
||||
Stats return +/- infinity when it makes sense. E.g., the variance
|
||||
of a Cauchy distribution is infinity. However, sometimes the
|
||||
statistic is undefined, e.g., if a distribution's pdf does not achieve a
|
||||
maximum within the support of the distribution, the mode is undefined.
|
||||
If the mean is undefined, then by definition the variance is undefined.
|
||||
E.g. the mean for Student's T for df = 1 is undefined (no clear way to say
|
||||
it is either + or - infinity), so the variance = E[(X - mean)^2] is also
|
||||
undefined.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`allow_nan_stats`</b>: Python boolean.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.batch_shape` {#MultivariateNormalDiagPlusLowRank.batch_shape}
|
||||
|
||||
Shape of a single sample from a single event index as a `TensorShape`.
|
||||
|
||||
May be partially defined or unknown.
|
||||
|
||||
The batch dimensions are indexes into independent, non-identical
|
||||
parameterizations of this distribution.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`batch_shape`</b>: `TensorShape`, possibly unknown.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiagPlusLowRank.batch_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single event index as a 1-D `Tensor`.
|
||||
|
||||
The batch dimensions are indexes into independent, non-identical
|
||||
parameterizations of this distribution.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: name to give to the op
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`batch_shape`</b>: `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.bijector` {#MultivariateNormalDiagPlusLowRank.bijector}
|
||||
|
||||
Function transforming x => y.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.cdf(value, name='cdf')` {#MultivariateNormalDiagPlusLowRank.cdf}
|
||||
|
||||
Cumulative distribution function.
|
||||
|
||||
Given random variable `X`, the cumulative distribution function `cdf` is:
|
||||
|
||||
```
|
||||
cdf(x) := P[X <= x]
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`cdf`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.copy(**override_parameters_kwargs)` {#MultivariateNormalDiagPlusLowRank.copy}
|
||||
|
||||
Creates a deep copy of the distribution.
|
||||
|
||||
Note: the copy distribution may continue to depend on the original
|
||||
intialization arguments.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`**override_parameters_kwargs`</b>: String/value dictionary of initialization
|
||||
arguments to override with new values.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`distribution`</b>: A new instance of `type(self)` intitialized from the union
|
||||
of self.parameters and override_parameters_kwargs, i.e.,
|
||||
`dict(self.parameters, **override_parameters_kwargs)`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.covariance(name='covariance')` {#MultivariateNormalDiagPlusLowRank.covariance}
|
||||
|
||||
Covariance.
|
||||
|
||||
Covariance is (possibly) defined only for non-scalar-event distributions.
|
||||
|
||||
For example, for a length-`k`, vector-valued distribution, it is calculated
|
||||
as,
|
||||
|
||||
```none
|
||||
Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])]
|
||||
```
|
||||
|
||||
where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E`
|
||||
denotes expectation.
|
||||
|
||||
Alternatively, for non-vector, multivariate distributions (e.g.,
|
||||
matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices
|
||||
under some vectorization of the events, i.e.,
|
||||
|
||||
```none
|
||||
Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above]
|
||||
````
|
||||
|
||||
where `Cov` is a (batch of) `k' x k'` matrices,
|
||||
`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function
|
||||
mapping indices of this distribution's event dimensions to indices of a
|
||||
length-`k'` vector.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`covariance`</b>: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']`
|
||||
where the first `n` dimensions are batch coordinates and
|
||||
`k' = reduce_prod(self.event_shape)`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.det_covariance(name='det_covariance')` {#MultivariateNormalDiagPlusLowRank.det_covariance}
|
||||
|
||||
Determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.distribution` {#MultivariateNormalDiagPlusLowRank.distribution}
|
||||
|
||||
Base distribution, p(x).
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.dtype` {#MultivariateNormalDiagPlusLowRank.dtype}
|
||||
|
||||
The `DType` of `Tensor`s handled by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.entropy(name='entropy')` {#MultivariateNormalDiagPlusLowRank.entropy}
|
||||
|
||||
Shannon entropy in nats.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.event_shape` {#MultivariateNormalDiagPlusLowRank.event_shape}
|
||||
|
||||
Shape of a single sample from a single batch as a `TensorShape`.
|
||||
|
||||
May be partially defined or unknown.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`event_shape`</b>: `TensorShape`, possibly unknown.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiagPlusLowRank.event_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: name to give to the op
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`event_shape`</b>: `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.is_continuous` {#MultivariateNormalDiagPlusLowRank.is_continuous}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiagPlusLowRank.is_scalar_batch}
|
||||
|
||||
Indicates that `batch_shape == []`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`is_scalar_batch`</b>: `Boolean` `scalar` `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiagPlusLowRank.is_scalar_event}
|
||||
|
||||
Indicates that `event_shape == []`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`is_scalar_event`</b>: `Boolean` `scalar` `Tensor`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.loc` {#MultivariateNormalDiagPlusLowRank.loc}
|
||||
|
||||
The `loc` `Tensor` in `Y = scale @ X + loc`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiagPlusLowRank.log_cdf}
|
||||
|
||||
Log cumulative distribution function.
|
||||
|
||||
Given random variable `X`, the cumulative distribution function `cdf` is:
|
||||
|
||||
```
|
||||
log_cdf(x) := Log[ P[X <= x] ]
|
||||
```
|
||||
|
||||
Often, a numerical approximation can be used for `log_cdf(x)` that yields
|
||||
a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
`x << -1`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`logcdf`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalDiagPlusLowRank.log_det_covariance}
|
||||
|
||||
Log of determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_prob(value, name='log_prob')` {#MultivariateNormalDiagPlusLowRank.log_prob}
|
||||
|
||||
Log probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalLinearOperator`:
|
||||
|
||||
`value` is a batch vector with compatible shape if `value` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```python
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```python
|
||||
[M1, ..., Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`log_prob`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiagPlusLowRank.log_survival_function}
|
||||
|
||||
Log survival function.
|
||||
|
||||
Given random variable `X`, the survival function is defined:
|
||||
|
||||
```
|
||||
log_survival_function(x) = Log[ P[X > x] ]
|
||||
= Log[ 1 - P[X <= x] ]
|
||||
= Log[ 1 - cdf(x) ]
|
||||
```
|
||||
|
||||
Typically, different numerical approximations can be used for the log
|
||||
survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type
|
||||
`self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.mean(name='mean')` {#MultivariateNormalDiagPlusLowRank.mean}
|
||||
|
||||
Mean.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.mode(name='mode')` {#MultivariateNormalDiagPlusLowRank.mode}
|
||||
|
||||
Mode.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.name` {#MultivariateNormalDiagPlusLowRank.name}
|
||||
|
||||
Name prepended to all ops created by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiagPlusLowRank.param_shapes}
|
||||
|
||||
Shapes of parameters given the desired shape of a call to `sample()`.
|
||||
|
||||
This is a class method that describes what key/value arguments are required
|
||||
to instantiate the given `Distribution` so that a particular shape is
|
||||
returned for that instance's call to `sample()`.
|
||||
|
||||
Subclasses should override class method `_param_shapes`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`sample_shape`</b>: `Tensor` or python list/tuple. Desired shape of a call to
|
||||
`sample()`.
|
||||
* <b>`name`</b>: name to prepend ops with.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`dict` of parameter name to `Tensor` shapes.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiagPlusLowRank.param_static_shapes}
|
||||
|
||||
param_shapes with static (i.e. `TensorShape`) shapes.
|
||||
|
||||
This is a class method that describes what key/value arguments are required
|
||||
to instantiate the given `Distribution` so that a particular shape is
|
||||
returned for that instance's call to `sample()`. Assumes that
|
||||
the sample's shape is known statically.
|
||||
|
||||
Subclasses should override class method `_param_shapes` to return
|
||||
constant-valued tensors when constant values are fed.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`sample_shape`</b>: `TensorShape` or python list/tuple. Desired shape of a call
|
||||
to `sample()`.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`dict` of parameter name to `TensorShape`.
|
||||
|
||||
##### Raises:
|
||||
|
||||
|
||||
* <b>`ValueError`</b>: if `sample_shape` is a `TensorShape` and is not fully defined.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.parameters` {#MultivariateNormalDiagPlusLowRank.parameters}
|
||||
|
||||
Dictionary of parameters used to instantiate this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.prob(value, name='prob')` {#MultivariateNormalDiagPlusLowRank.prob}
|
||||
|
||||
Probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalLinearOperator`:
|
||||
|
||||
`value` is a batch vector with compatible shape if `value` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```python
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```python
|
||||
[M1, ..., Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`prob`</b>: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with
|
||||
values of type `self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.reparameterization_type` {#MultivariateNormalDiagPlusLowRank.reparameterization_type}
|
||||
|
||||
Describes how samples from the distribution are reparameterized.
|
||||
|
||||
Currently this is one of the static instances
|
||||
`distributions.FULLY_REPARAMETERIZED`
|
||||
or `distributions.NOT_REPARAMETERIZED`.
|
||||
|
||||
##### Returns:
|
||||
|
||||
An instance of `ReparameterizationType`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiagPlusLowRank.sample}
|
||||
|
||||
Generate samples of the specified shape.
|
||||
|
||||
Note that a call to `sample()` without arguments will generate a single
|
||||
sample.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`sample_shape`</b>: 0D or 1D `int32` `Tensor`. Shape of the generated samples.
|
||||
* <b>`seed`</b>: Python integer seed for RNG
|
||||
* <b>`name`</b>: name to give to the op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`samples`</b>: a `Tensor` with prepended dimensions `sample_shape`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.scale` {#MultivariateNormalDiagPlusLowRank.scale}
|
||||
|
||||
The `scale` `LinearOperator` in `Y = scale @ X + loc`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.stddev(name='stddev')` {#MultivariateNormalDiagPlusLowRank.stddev}
|
||||
|
||||
Standard deviation.
|
||||
|
||||
Standard deviation is defined as,
|
||||
|
||||
```none
|
||||
stddev = E[(X - E[X])**2]**0.5
|
||||
```
|
||||
|
||||
where `X` is the random variable associated with this distribution, `E`
|
||||
denotes expectation, and `stddev.shape = batch_shape + event_shape`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`stddev`</b>: Floating-point `Tensor` with shape identical to
|
||||
`batch_shape + event_shape`, i.e., the same shape as `self.mean()`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.survival_function(value, name='survival_function')` {#MultivariateNormalDiagPlusLowRank.survival_function}
|
||||
|
||||
Survival function.
|
||||
|
||||
Given random variable `X`, the survival function is defined:
|
||||
|
||||
```
|
||||
survival_function(x) = P[X > x]
|
||||
= 1 - P[X <= x]
|
||||
= 1 - cdf(x).
|
||||
```
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`value`</b>: `float` or `double` `Tensor`.
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
`Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type
|
||||
`self.dtype`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.validate_args` {#MultivariateNormalDiagPlusLowRank.validate_args}
|
||||
|
||||
Python boolean indicated possibly expensive checks are enabled.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.variance(name='variance')` {#MultivariateNormalDiagPlusLowRank.variance}
|
||||
|
||||
Variance.
|
||||
|
||||
Variance is defined as,
|
||||
|
||||
```none
|
||||
Var = E[(X - E[X])**2]
|
||||
```
|
||||
|
||||
where `X` is the random variable associated with this distribution, `E`
|
||||
denotes expectation, and `Var.shape = batch_shape + event_shape`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`name`</b>: The name to give this op.
|
||||
|
||||
##### Returns:
|
||||
|
||||
|
||||
* <b>`variance`</b>: Floating-point `Tensor` with shape identical to
|
||||
`batch_shape + event_shape`, i.e., the same shape as `self.mean()`.
|
||||
|
||||
|
@ -417,15 +417,6 @@ a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
|
||||
Log probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `TransformedDistribution`:
|
||||
|
||||
Implements `(log o p o g^{-1})(y) + (log o abs o det o J o g^{-1})(y)`,
|
||||
where `g^{-1}` is the inverse of `transform`.
|
||||
|
||||
Also raises a `ValueError` if `inverse` was not provided to the
|
||||
distribution and `y` was not returned from `sample`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
@ -563,15 +554,6 @@ Dictionary of parameters used to instantiate this `Distribution`.
|
||||
|
||||
Probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `TransformedDistribution`:
|
||||
|
||||
Implements `p(g^{-1}(y)) det|J(g^{-1}(y))|`, where `g^{-1}` is the
|
||||
inverse of `transform`.
|
||||
|
||||
Also raises a `ValueError` if `inverse` was not provided to the
|
||||
distribution and `y` was not returned from `sample`.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
|
@ -1,75 +1,146 @@
|
||||
The multivariate normal distribution on `R^k`.
|
||||
|
||||
This distribution is defined by a 1-D mean `mu` and covariance matrix `sigma`.
|
||||
Evaluation of the pdf, determinant, and sampling are all `O(k^3)` operations.
|
||||
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
|
||||
#### Mathematical Details
|
||||
|
||||
With `C = sigma`, the PDF of this distribution is:
|
||||
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)|,
|
||||
```
|
||||
f(x) = (2 pi)^(-k/2) |det(C)|^(-1/2) exp(-1/2 (x - mu)^T C^{-1} (x - mu))
|
||||
|
||||
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 = scale_tril
|
||||
```
|
||||
|
||||
where `scale_tril` is lower-triangular `k x k` matrix with non-zero diagonal,
|
||||
i.e., `tf.diag_part(scale_tril) != 0`.
|
||||
|
||||
Additional leading dimensions (if any) will index batches.
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
Trainable (batch) Cholesky matrices can be created with
|
||||
`ds.matrix_diag_transform()` and/or `ds.fill_lower_triangular()`
|
||||
|
||||
#### Examples
|
||||
|
||||
A single multi-variate Gaussian distribution is defined by a vector of means
|
||||
of length `k`, and a covariance matrix of shape `k x k`.
|
||||
|
||||
Extra leading dimensions, if provided, allow for batches.
|
||||
|
||||
```python
|
||||
# Initialize a single 3-variate Gaussian with diagonal covariance.
|
||||
mu = [1, 2, 3.]
|
||||
sigma = [[1, 0, 0], [0, 3, 0], [0, 0, 2.]]
|
||||
dist = tf.contrib.distributions.MultivariateNormalFull(mu, chol)
|
||||
ds = tf.contrib.distributions
|
||||
|
||||
# Evaluate this on an observation in R^3, returning a scalar.
|
||||
dist.pdf([-1, 0, 1])
|
||||
# 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]]
|
||||
scale = tf.cholesky(cov)
|
||||
# ==> [[ 0.6, 0. , 0. ],
|
||||
# [ 0.2, 0.5, 0. ],
|
||||
# [ 0.1, -0.3, 0.4]])
|
||||
mvn = ds.MultivariateNormalTriL(
|
||||
loc=mu,
|
||||
scale_tril=scale)
|
||||
|
||||
# Initialize a batch of two 3-variate Gaussians.
|
||||
mu = [[1, 2, 3], [11, 22, 33.]]
|
||||
sigma = ... # shape 2 x 3 x 3, positive definite.
|
||||
dist = tf.contrib.distributions.MultivariateNormalFull(mu, sigma)
|
||||
mvn.mean().eval()
|
||||
# ==> [1., 2, 3]
|
||||
|
||||
# Covariance agrees with cholesky(cov) parameterization.
|
||||
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]
|
||||
tril = ... # shape: [2, 3, 3], lower triangular, non-zero diagonal.
|
||||
mvn = ds.MultivariateNormalTriL(
|
||||
loc=mu,
|
||||
scale_tril=tril)
|
||||
|
||||
# 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]
|
||||
|
||||
# Evaluate this on a two observations, each in R^3, returning a length two
|
||||
# tensor.
|
||||
x = [[-1, 0, 1], [-11, 0, 11.]] # Shape 2 x 3.
|
||||
dist.pdf(x)
|
||||
```
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.__init__(mu, sigma, validate_args=False, allow_nan_stats=True, name='MultivariateNormalFull')` {#MultivariateNormalFull.__init__}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.__init__(loc=None, scale_tril=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalTriL')` {#MultivariateNormalTriL.__init__}
|
||||
|
||||
Multivariate Normal distributions on `R^k`.
|
||||
Construct Multivariate Normal distribution on `R^k`.
|
||||
|
||||
User must provide means `mu` and `sigma`, the mean and covariance.
|
||||
The `batch_shape` is the broadcast shape between `loc` and `scale`
|
||||
arguments.
|
||||
|
||||
The `event_shape` is given by the last dimension of `loc` or the last
|
||||
dimension of the matrix implied by `scale`.
|
||||
|
||||
Recall that `covariance = scale @ scale.T`. A (non-batch) `scale` matrix
|
||||
is:
|
||||
|
||||
```none
|
||||
scale = scale_tril
|
||||
```
|
||||
|
||||
where `scale_tril` is lower-triangular `k x k` matrix with non-zero
|
||||
diagonal, i.e., `tf.diag_part(scale_tril) != 0`.
|
||||
|
||||
Additional leading dimensions (if any) will index batches.
|
||||
|
||||
##### Args:
|
||||
|
||||
|
||||
* <b>`mu`</b>: `(N+1)-D` floating point tensor with shape `[N1,...,Nb, k]`,
|
||||
`b >= 0`.
|
||||
* <b>`sigma`</b>: `(N+2)-D` `Tensor` with same `dtype` as `mu` and shape
|
||||
`[N1,...,Nb, k, k]`. Each batch member must be positive definite.
|
||||
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to validate input
|
||||
with asserts. If `validate_args` is `False`, and the inputs are
|
||||
invalid, correct behavior is not guaranteed.
|
||||
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an
|
||||
exception if a statistic (e.g. mean/mode/etc...) is undefined for any
|
||||
batch member If `True`, batch members with valid parameters leading to
|
||||
undefined statistics will return NaN for this statistic.
|
||||
* <b>`name`</b>: The name to give Ops created by the initializer.
|
||||
* <b>`loc`</b>: Floating-point `Tensor`. If this is set to `None`, `loc` is
|
||||
implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where
|
||||
`b >= 0` and `k` is the event size.
|
||||
* <b>`scale_tril`</b>: Floating-point, lower-triangular `Tensor` with non-zero
|
||||
diagonal elements. `scale_tril` has shape `[B1, ..., Bb, k, k]` where
|
||||
`b >= 0` and `k` is the event size.
|
||||
* <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
|
||||
parameters are checked for validity despite possibly degrading runtime
|
||||
performance. When `False` invalid inputs may silently render incorrect
|
||||
outputs.
|
||||
* <b>`allow_nan_stats`</b>: Python `Boolean`, default `True`. When `True`,
|
||||
statistics (e.g., mean, mode, variance) use the value "`NaN`" to
|
||||
indicate the result is undefined. When `False`, an exception is raised
|
||||
if one or more of the statistic's batch members are undefined.
|
||||
* <b>`name`</b>: `String` name prefixed to Ops created by this class.
|
||||
|
||||
##### Raises:
|
||||
|
||||
|
||||
* <b>`TypeError`</b>: If `mu` and `sigma` are different dtypes.
|
||||
* <b>`ValueError`</b>: if neither `loc` nor `scale_tril` are specified.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.allow_nan_stats` {#MultivariateNormalFull.allow_nan_stats}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.allow_nan_stats` {#MultivariateNormalTriL.allow_nan_stats}
|
||||
|
||||
Python boolean describing behavior when a stat is undefined.
|
||||
|
||||
@ -90,7 +161,7 @@ undefined.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.batch_shape` {#MultivariateNormalFull.batch_shape}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.batch_shape` {#MultivariateNormalTriL.batch_shape}
|
||||
|
||||
Shape of a single sample from a single event index as a `TensorShape`.
|
||||
|
||||
@ -107,7 +178,7 @@ parameterizations of this distribution.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalFull.batch_shape_tensor}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalTriL.batch_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single event index as a 1-D `Tensor`.
|
||||
|
||||
@ -127,7 +198,14 @@ parameterizations of this distribution.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.cdf(value, name='cdf')` {#MultivariateNormalFull.cdf}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.bijector` {#MultivariateNormalTriL.bijector}
|
||||
|
||||
Function transforming x => y.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.cdf(value, name='cdf')` {#MultivariateNormalTriL.cdf}
|
||||
|
||||
Cumulative distribution function.
|
||||
|
||||
@ -152,7 +230,7 @@ cdf(x) := P[X <= x]
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.copy(**override_parameters_kwargs)` {#MultivariateNormalFull.copy}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.copy(**override_parameters_kwargs)` {#MultivariateNormalTriL.copy}
|
||||
|
||||
Creates a deep copy of the distribution.
|
||||
|
||||
@ -175,7 +253,7 @@ intialization arguments.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.covariance(name='covariance')` {#MultivariateNormalFull.covariance}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.covariance(name='covariance')` {#MultivariateNormalTriL.covariance}
|
||||
|
||||
Covariance.
|
||||
|
||||
@ -219,21 +297,35 @@ length-`k'` vector.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.dtype` {#MultivariateNormalFull.dtype}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.det_covariance(name='det_covariance')` {#MultivariateNormalTriL.det_covariance}
|
||||
|
||||
Determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.distribution` {#MultivariateNormalTriL.distribution}
|
||||
|
||||
Base distribution, p(x).
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.dtype` {#MultivariateNormalTriL.dtype}
|
||||
|
||||
The `DType` of `Tensor`s handled by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.entropy(name='entropy')` {#MultivariateNormalFull.entropy}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.entropy(name='entropy')` {#MultivariateNormalTriL.entropy}
|
||||
|
||||
Shannon entropy in nats.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.event_shape` {#MultivariateNormalFull.event_shape}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.event_shape` {#MultivariateNormalTriL.event_shape}
|
||||
|
||||
Shape of a single sample from a single batch as a `TensorShape`.
|
||||
|
||||
@ -247,7 +339,7 @@ May be partially defined or unknown.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalFull.event_shape_tensor}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalTriL.event_shape_tensor}
|
||||
|
||||
Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
|
||||
|
||||
@ -264,14 +356,14 @@ Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.is_continuous` {#MultivariateNormalFull.is_continuous}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.is_continuous` {#MultivariateNormalTriL.is_continuous}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalFull.is_scalar_batch}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalTriL.is_scalar_batch}
|
||||
|
||||
Indicates that `batch_shape == []`.
|
||||
|
||||
@ -288,7 +380,7 @@ Indicates that `batch_shape == []`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalFull.is_scalar_event}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalTriL.is_scalar_event}
|
||||
|
||||
Indicates that `event_shape == []`.
|
||||
|
||||
@ -305,7 +397,14 @@ Indicates that `event_shape == []`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.log_cdf(value, name='log_cdf')` {#MultivariateNormalFull.log_cdf}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.loc` {#MultivariateNormalTriL.loc}
|
||||
|
||||
The `loc` `Tensor` in `Y = scale @ X + loc`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.log_cdf(value, name='log_cdf')` {#MultivariateNormalTriL.log_cdf}
|
||||
|
||||
Log cumulative distribution function.
|
||||
|
||||
@ -334,24 +433,31 @@ a more accurate answer than simply taking the logarithm of the `cdf` when
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.log_prob(value, name='log_prob')` {#MultivariateNormalFull.log_prob}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalTriL.log_det_covariance}
|
||||
|
||||
Log of determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.log_prob(value, name='log_prob')` {#MultivariateNormalTriL.log_prob}
|
||||
|
||||
Log probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
Additional documentation from `_MultivariateNormalLinearOperator`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
`value` is a batch vector with compatible shape if `value` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
```python
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```python
|
||||
[M1, ..., Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
@ -369,14 +475,7 @@ or
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.log_sigma_det(name='log_sigma_det')` {#MultivariateNormalFull.log_sigma_det}
|
||||
|
||||
Log of determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalFull.log_survival_function}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalTriL.log_survival_function}
|
||||
|
||||
Log survival function.
|
||||
|
||||
@ -405,35 +504,28 @@ survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.mean(name='mean')` {#MultivariateNormalFull.mean}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.mean(name='mean')` {#MultivariateNormalTriL.mean}
|
||||
|
||||
Mean.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.mode(name='mode')` {#MultivariateNormalFull.mode}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.mode(name='mode')` {#MultivariateNormalTriL.mode}
|
||||
|
||||
Mode.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.mu` {#MultivariateNormalFull.mu}
|
||||
|
||||
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.name` {#MultivariateNormalFull.name}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.name` {#MultivariateNormalTriL.name}
|
||||
|
||||
Name prepended to all ops created by this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalFull.param_shapes}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalTriL.param_shapes}
|
||||
|
||||
Shapes of parameters given the desired shape of a call to `sample()`.
|
||||
|
||||
@ -457,7 +549,7 @@ Subclasses should override class method `_param_shapes`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.param_static_shapes(cls, sample_shape)` {#MultivariateNormalFull.param_static_shapes}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.param_static_shapes(cls, sample_shape)` {#MultivariateNormalTriL.param_static_shapes}
|
||||
|
||||
param_shapes with static (i.e. `TensorShape`) shapes.
|
||||
|
||||
@ -487,31 +579,31 @@ constant-valued tensors when constant values are fed.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.parameters` {#MultivariateNormalFull.parameters}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.parameters` {#MultivariateNormalTriL.parameters}
|
||||
|
||||
Dictionary of parameters used to instantiate this `Distribution`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.prob(value, name='prob')` {#MultivariateNormalFull.prob}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.prob(value, name='prob')` {#MultivariateNormalTriL.prob}
|
||||
|
||||
Probability density/mass function (depending on `is_continuous`).
|
||||
|
||||
|
||||
Additional documentation from `_MultivariateNormalOperatorPD`:
|
||||
Additional documentation from `_MultivariateNormalLinearOperator`:
|
||||
|
||||
`x` is a batch vector with compatible shape if `x` is a `Tensor` whose
|
||||
`value` is a batch vector with compatible shape if `value` is a `Tensor` whose
|
||||
shape can be broadcast up to either:
|
||||
|
||||
```
|
||||
```python
|
||||
self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
[M1,...,Mm] + self.batch_shape + self.event_shape
|
||||
```python
|
||||
[M1, ..., Mm] + self.batch_shape + self.event_shape
|
||||
```
|
||||
|
||||
##### Args:
|
||||
@ -529,7 +621,7 @@ or
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.reparameterization_type` {#MultivariateNormalFull.reparameterization_type}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.reparameterization_type` {#MultivariateNormalTriL.reparameterization_type}
|
||||
|
||||
Describes how samples from the distribution are reparameterized.
|
||||
|
||||
@ -544,7 +636,7 @@ or `distributions.NOT_REPARAMETERIZED`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalFull.sample}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalTriL.sample}
|
||||
|
||||
Generate samples of the specified shape.
|
||||
|
||||
@ -566,21 +658,14 @@ sample.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.sigma` {#MultivariateNormalFull.sigma}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.scale` {#MultivariateNormalTriL.scale}
|
||||
|
||||
Dense (batch) covariance matrix, if available.
|
||||
The `scale` `LinearOperator` in `Y = scale @ X + loc`.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.sigma_det(name='sigma_det')` {#MultivariateNormalFull.sigma_det}
|
||||
|
||||
Determinant of covariance matrix.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.stddev(name='stddev')` {#MultivariateNormalFull.stddev}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.stddev(name='stddev')` {#MultivariateNormalTriL.stddev}
|
||||
|
||||
Standard deviation.
|
||||
|
||||
@ -607,7 +692,7 @@ denotes expectation, and `stddev.shape = batch_shape + event_shape`.
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.survival_function(value, name='survival_function')` {#MultivariateNormalFull.survival_function}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.survival_function(value, name='survival_function')` {#MultivariateNormalTriL.survival_function}
|
||||
|
||||
Survival function.
|
||||
|
||||
@ -633,14 +718,14 @@ survival_function(x) = P[X > x]
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.validate_args` {#MultivariateNormalFull.validate_args}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.validate_args` {#MultivariateNormalTriL.validate_args}
|
||||
|
||||
Python boolean indicated possibly expensive checks are enabled.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
#### `tf.contrib.distributions.MultivariateNormalFull.variance(name='variance')` {#MultivariateNormalFull.variance}
|
||||
#### `tf.contrib.distributions.MultivariateNormalTriL.variance(name='variance')` {#MultivariateNormalTriL.variance}
|
||||
|
||||
Variance.
|
||||
|
@ -766,11 +766,10 @@
|
||||
* [`matrix_diag_transform`](../../api_docs/python/contrib.distributions.md#matrix_diag_transform)
|
||||
* [`Mixture`](../../api_docs/python/contrib.distributions.md#Mixture)
|
||||
* [`Multinomial`](../../api_docs/python/contrib.distributions.md#Multinomial)
|
||||
* [`MultivariateNormalCholesky`](../../api_docs/python/contrib.distributions.md#MultivariateNormalCholesky)
|
||||
* [`MultivariateNormalDiag`](../../api_docs/python/contrib.distributions.md#MultivariateNormalDiag)
|
||||
* [`MultivariateNormalDiagPlusVDVT`](../../api_docs/python/contrib.distributions.md#MultivariateNormalDiagPlusVDVT)
|
||||
* [`MultivariateNormalDiagWithSoftplusStDev`](../../api_docs/python/contrib.distributions.md#MultivariateNormalDiagWithSoftplusStDev)
|
||||
* [`MultivariateNormalFull`](../../api_docs/python/contrib.distributions.md#MultivariateNormalFull)
|
||||
* [`MultivariateNormalDiagPlusLowRank`](../../api_docs/python/contrib.distributions.md#MultivariateNormalDiagPlusLowRank)
|
||||
* [`MultivariateNormalDiagWithSoftplusScale`](../../api_docs/python/contrib.distributions.md#MultivariateNormalDiagWithSoftplusScale)
|
||||
* [`MultivariateNormalTriL`](../../api_docs/python/contrib.distributions.md#MultivariateNormalTriL)
|
||||
* [`Normal`](../../api_docs/python/contrib.distributions.md#Normal)
|
||||
* [`normal_conjugates_known_scale_posterior`](../../api_docs/python/contrib.distributions.md#normal_conjugates_known_scale_posterior)
|
||||
* [`normal_conjugates_known_scale_predictive`](../../api_docs/python/contrib.distributions.md#normal_conjugates_known_scale_predictive)
|
||||
|
Loading…
x
Reference in New Issue
Block a user