LostTech.TensorFlow : API Documentation

Type Multinomial

Namespace tensorflow.distributions

Parent Distribution

Interfaces IMultinomial

Multinomial distribution.

This Multinomial distribution is parameterized by `probs`, a (batch of) length-`K` `prob` (probability) vectors (`K > 1`) such that `tf.reduce_sum(probs, -1) = 1`, and a `total_count` number of trials, i.e., the number of trials per draw from the Multinomial. It is defined over a (batch of) length-`K` vector `counts` such that `tf.reduce_sum(counts, -1) = total_count`. The Multinomial is identically the Binomial distribution when `K = 2`.

#### Mathematical Details

The Multinomial is a distribution over `K`-class counts, i.e., a length-`K` vector of non-negative integer `counts = n = [n_0,..., n_{K-1}]`.

The probability mass function (pmf) is,

```none pmf(n; pi, N) = prod_j (pi_j)**n_j / Z Z = (prod_j n_j!) / N! ```

where: * `probs = pi = [pi_0,..., pi_{K-1}]`, `pi_j > 0`, `sum_j pi_j = 1`, * `total_count = N`, `N` a positive integer, * `Z` is the normalization constant, and, * `N!` denotes `N` factorial.

Distribution parameters are automatically broadcast in all functions; see examples for details.

#### Pitfalls

The number of classes, `K`, must not exceed: - the largest integer representable by `self.dtype`, i.e., `2**(mantissa_bits+1)` (IEE754), - the maximum `Tensor` index, i.e., `2**31-1`.

In other words, Note: This condition is validated only when `self.validate_args = True`.

#### Examples

Create a 3-class distribution, with the 3rd class is most likely to be drawn, using logits. Create a 3-class distribution, with the 3rd class is most likely to be drawn. The distribution functions can be evaluated on counts. Create a 2-batch of 3-class distributions.
Show Example
K <= min(2**31-1, {
              tf.float16: 2**11,
              tf.float32: 2**24,
              tf.float64: 2**53 }[param.dtype]) 



Public static methods

Multinomial NewDyn(object total_count, object logits, object probs, ImplicitContainer<T> validate_args, ImplicitContainer<T> allow_nan_stats, ImplicitContainer<T> name)

Construct Student's t distributions. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed after 2019-01-01. Instructions for updating: The TensorFlow Distributions library has moved to TensorFlow Probability (https://github.com/tensorflow/probability). You should update all references to use `tfp.distributions` instead of tf.distributions.

The distributions have degree of freedom `df`, mean `loc`, and scale `scale`.

The parameters `df`, `loc`, and `scale` must be shaped in a way that supports broadcasting (e.g. `df + loc + scale` is a valid operation).
object total_count
object logits
object probs
ImplicitContainer<T> validate_args
Python `bool`, default `False`. When `True` distribution parameters are checked for validity despite possibly degrading runtime performance. When `False` invalid inputs may silently render incorrect outputs.
ImplicitContainer<T> allow_nan_stats
Python `bool`, 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.
ImplicitContainer<T> name
Python `str` name prefixed to Ops created by this class.

Public properties

object allow_nan_stats get;

object allow_nan_stats_dyn get;

TensorShape batch_shape get;

object batch_shape_dyn get;

object dtype get;

object dtype_dyn get;

TensorShape event_shape get;

object event_shape_dyn get;

object logits get;

Vector of coordinatewise logits.

object logits_dyn get;

Vector of coordinatewise logits.

string name get;

object name_dyn get;

IDictionary<object, object> parameters get;

object parameters_dyn get;

Tensor probs get;

Probability of drawing a `1` in that coordinate.

object probs_dyn get;

Probability of drawing a `1` in that coordinate.

object PythonObject get;

object reparameterization_type get;

object reparameterization_type_dyn get;

object total_count get;

Number of trials used to construct a sample.

object total_count_dyn get;

Number of trials used to construct a sample.

object validate_args get;

object validate_args_dyn get;