Update generated Python Op docs.

Change: 145835977
This commit is contained in:
A. Unique TensorFlower 2017-01-27 14:19:12 -08:00 committed by TensorFlower Gardener
parent 73c7c0c0f3
commit 0b989ef0ed
7 changed files with 514 additions and 518 deletions

View File

@ -775,29 +775,41 @@ Variance.
Binomial distribution. Binomial distribution.
This distribution is parameterized by a vector `p` of probabilities and `n`, This distribution is parameterized by `probs`, a (batch of) probabilities for
the total counts. drawing a `1` and `total_count`, the number of trials per draw from the
Binomial.
#### Mathematical details #### Mathematical Details
The Binomial is a distribution over the number of successes in `n` independent The Binomial is a distribution over the number of `1`'s in `total_count`
trials, with each trial having the same probability of success `p`. independent trials, with each trial having the same probability of `1`, i.e.,
The probability mass function (pmf): `probs`.
```pmf(k) = n! / (k! * (n - k)!) * (p)^k * (1 - p)^(n - k)``` The probability mass function (pmf) is,
```none
pmf(k; n, p) = p**k (1 - p)**(n - k) / Z
Z = k! (n - k)! / n!
```
where:
* `total_count = n`,
* `probs = p`,
* `Z` is the normalizaing constant, and,
* `n!` is the factorial of `n`.
#### Examples #### Examples
Create a single distribution, corresponding to 5 coin flips. Create a single distribution, corresponding to 5 coin flips.
```python ```python
dist = Binomial(n=5., p=.5) dist = Binomial(total_count=5., probs=.5)
``` ```
Create a single distribution (using logits), corresponding to 5 coin flips. Create a single distribution (using logits), corresponding to 5 coin flips.
```python ```python
dist = Binomial(n=5., logits=0.) dist = Binomial(total_count=5., logits=0.)
``` ```
Creates 3 distributions with the third distribution most likely to have Creates 3 distributions with the third distribution most likely to have
@ -806,7 +818,7 @@ successes.
```python ```python
p = [.2, .3, .8] p = [.2, .3, .8]
# n will be broadcast to [4., 4., 4.], to match p. # n will be broadcast to [4., 4., 4.], to match p.
dist = Binomial(n=4., p=p) dist = Binomial(total_count=4., probs=p)
``` ```
The distribution functions can be evaluated on counts. The distribution functions can be evaluated on counts.
@ -826,45 +838,35 @@ dist.prob(counts) # Shape [5, 7, 3]
``` ```
- - - - - -
#### `tf.contrib.distributions.Binomial.__init__(n, logits=None, p=None, validate_args=False, allow_nan_stats=True, name='Binomial')` {#Binomial.__init__} #### `tf.contrib.distributions.Binomial.__init__(total_count, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='Binomial')` {#Binomial.__init__}
Initialize a batch of Binomial distributions. Initialize a batch of Binomial distributions.
##### Args: ##### Args:
* <b>`n`</b>: Non-negative floating point tensor with shape broadcastable to * <b>`total_count`</b>: Non-negative floating point tensor with shape broadcastable
`[N1,..., Nm]` with `m >= 0` and the same dtype as `p` or `logits`. to `[N1,..., Nm]` with `m >= 0` and the same dtype as `probs` or
Defines this as a batch of `N1 x ... x Nm` different Binomial `logits`. Defines this as a batch of `N1 x ... x Nm` different Binomial
distributions. Its components should be equal to integer values. distributions. Its components should be equal to integer values.
* <b>`logits`</b>: Floating point tensor representing the log-odds of a * <b>`logits`</b>: Floating point tensor representing the log-odds of a
positive event with shape broadcastable to `[N1,..., Nm]` `m >= 0`, and positive event with shape broadcastable to `[N1,..., Nm]` `m >= 0`, and
the same dtype as `n`. Each entry represents logits for the probability the same dtype as `total_count`. Each entry represents logits for the
of success for independent Binomial distributions. Only one of
`logits` or `p` should be passed in.
* <b>`p`</b>: Positive floating point tensor with shape broadcastable to
`[N1,..., Nm]` `m >= 0`, `p in [0, 1]`. Each entry represents the
probability of success for independent Binomial distributions. Only one probability of success for independent Binomial distributions. Only one
of `logits` or `p` should be passed in. of `logits` or `probs` should be passed in.
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to assert valid values * <b>`probs`</b>: Positive floating point tensor with shape broadcastable to
for parameters `n`, `p`, and `x` in `prob` and `log_prob`. `[N1,..., Nm]` `m >= 0`, `probs in [0, 1]`. Each entry represents the
If `False` and inputs are invalid, correct behavior is not guaranteed. probability of success for independent Binomial distributions. Only one
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an of `logits` or `probs` should be passed in.
exception if a statistic (e.g. mean/mode/etc...) is undefined for any * <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
batch member. If `True`, batch members with valid parameters leading to parameters are checked for validity despite possibly degrading runtime
undefined statistics will return NaN for this statistic. performance. When `False` invalid inputs may silently render incorrect
* <b>`name`</b>: The name to prefix Ops created by this distribution class. 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
* <b>`Examples`</b>: result is undefined. When `False`, an exception is raised if one or
more of the statistic's batch members are undefined.
```python * <b>`name`</b>: `String` name prefixed to Ops created by this class.
# Define 1-batch of a binomial distribution.
dist = Binomial(n=2., p=.9)
# Define a 2-batch.
dist = Binomial(n=[4., 5], p=[.1, .3])
```
- - - - - -
@ -1142,15 +1144,15 @@ Log probability density/mass function (depending on `is_continuous`).
Additional documentation from `Binomial`: Additional documentation from `Binomial`:
For each batch member of counts `value`, `P[counts]` is the probability that For each batch member of counts `value`, `P[value]` is the probability that
after sampling `n` draws from this Binomial distribution, the number of after sampling `self.total_count` draws from this Binomial distribution, the
successes is `k`. Note that different sequences of draws can result in the number of successes is `value`. Since different sequences of draws can result in
same counts, thus the probability includes a combinatorial coefficient. the same counts, the probability includes a combinatorial coefficient.
`value` must be a non-negative tensor with dtype `dtype` and whose shape Note: `value` must be a non-negative tensor with dtype `dtype` and whose shape
can be broadcast with `self.p` and `self.n`. `counts` is only legal if it is can be broadcast with `self.probs` and `self.total_count`. `value` is only legal
less than or equal to `n` and its components are equal to integer if it is less than or equal to `self.total_count` and its components are equal
values. to integer values.
##### Args: ##### Args:
@ -1198,7 +1200,7 @@ survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
#### `tf.contrib.distributions.Binomial.logits` {#Binomial.logits} #### `tf.contrib.distributions.Binomial.logits` {#Binomial.logits}
Log-odds of success. Log-odds of drawing a `1`.
- - - - - -
@ -1216,16 +1218,10 @@ Mode.
Additional documentation from `Binomial`: Additional documentation from `Binomial`:
Note that when `(n + 1) * p` is an integer, there are actually two Note that when `(1 + total_count) * probs` is an integer, there are
modes. Namely, `(n + 1) * p` and `(n + 1) * p - 1` are both modes. Here actually two modes. Namely, `(1 + total_count) * probs` and
we return only the larger of the two modes. `(1 + total_count) * probs - 1` are both modes. Here we return only the
larger of the two modes.
- - -
#### `tf.contrib.distributions.Binomial.n` {#Binomial.n}
Number of trials.
- - - - - -
@ -1235,13 +1231,6 @@ Number of trials.
Name prepended to all ops created by this `Distribution`. Name prepended to all ops created by this `Distribution`.
- - -
#### `tf.contrib.distributions.Binomial.p` {#Binomial.p}
Probability of success.
- - - - - -
#### `tf.contrib.distributions.Binomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Binomial.param_shapes} #### `tf.contrib.distributions.Binomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Binomial.param_shapes}
@ -1360,15 +1349,15 @@ Probability density/mass function (depending on `is_continuous`).
Additional documentation from `Binomial`: Additional documentation from `Binomial`:
For each batch member of counts `value`, `P[counts]` is the probability that For each batch member of counts `value`, `P[value]` is the probability that
after sampling `n` draws from this Binomial distribution, the number of after sampling `self.total_count` draws from this Binomial distribution, the
successes is `k`. Note that different sequences of draws can result in the number of successes is `value`. Since different sequences of draws can result in
same counts, thus the probability includes a combinatorial coefficient. the same counts, the probability includes a combinatorial coefficient.
`value` must be a non-negative tensor with dtype `dtype` and whose shape Note: `value` must be a non-negative tensor with dtype `dtype` and whose shape
can be broadcast with `self.p` and `self.n`. `counts` is only legal if it is can be broadcast with `self.probs` and `self.total_count`. `value` is only legal
less than or equal to `n` and its components are equal to integer if it is less than or equal to `self.total_count` and its components are equal
values. to integer values.
##### Args: ##### Args:
@ -1383,6 +1372,13 @@ values.
values of type `self.dtype`. values of type `self.dtype`.
- - -
#### `tf.contrib.distributions.Binomial.probs` {#Binomial.probs}
Probability of of drawing a `1`.
- - - - - -
#### `tf.contrib.distributions.Binomial.reparameterization_type` {#Binomial.reparameterization_type} #### `tf.contrib.distributions.Binomial.reparameterization_type` {#Binomial.reparameterization_type}
@ -1453,6 +1449,13 @@ survival_function(x) = P[X > x]
`self.dtype`. `self.dtype`.
- - -
#### `tf.contrib.distributions.Binomial.total_count` {#Binomial.total_count}
Number of trials.
- - - - - -
#### `tf.contrib.distributions.Binomial.validate_args` {#Binomial.validate_args} #### `tf.contrib.distributions.Binomial.validate_args` {#Binomial.validate_args}
@ -1474,34 +1477,35 @@ Variance.
Bernoulli distribution. Bernoulli distribution.
The Bernoulli distribution is parameterized by p, the probability of a The Bernoulli distribution with `probs` parameter, i.e., the probability of a
positive event. `1` outcome (vs a `0` outcome).
- - - - - -
#### `tf.contrib.distributions.Bernoulli.__init__(logits=None, p=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Bernoulli')` {#Bernoulli.__init__} #### `tf.contrib.distributions.Bernoulli.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Bernoulli')` {#Bernoulli.__init__}
Construct Bernoulli distributions. Construct Bernoulli distributions.
##### Args: ##### Args:
* <b>`logits`</b>: An N-D `Tensor` representing the log-odds * <b>`logits`</b>: An N-D `Tensor` representing the log-odds of a `1` event. Each
of a positive event. Each entry in the `Tensor` parametrizes entry in the `Tensor` parametrizes an independent Bernoulli distribution
an independent Bernoulli distribution where the probability of an event where the probability of an event is sigmoid(logits). Only one of
is sigmoid(logits). Only one of `logits` or `p` should be passed in. `logits` or `probs` should be passed in.
* <b>`p`</b>: An N-D `Tensor` representing the probability of a positive * <b>`probs`</b>: An N-D `Tensor` representing the probability of a `1`
event. Each entry in the `Tensor` parameterizes an independent event. Each entry in the `Tensor` parameterizes an independent
Bernoulli distribution. Only one of `logits` or `p` should be passed Bernoulli distribution. Only one of `logits` or `probs` should be passed
in. in.
* <b>`dtype`</b>: dtype for samples. * <b>`dtype`</b>: The type of the event samples. Default: `int32`.
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to validate that * <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
`0 <= p <= 1`. If `validate_args` is `False`, and the inputs are parameters are checked for validity despite possibly degrading runtime
invalid, methods like `log_pmf` may return `NaN` values. performance. When `False` invalid inputs may silently render incorrect
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an outputs.
exception if a statistic (e.g. mean/mode/etc...) is undefined for any * <b>`allow_nan_stats`</b>: Python `Boolean`, default `True`. When `True`,
batch member. If `True`, batch members with valid parameters leading to statistics (e.g., mean, mode, variance) use the value "`NaN`" to
undefined statistics will return NaN for this statistic. indicate the result is undefined. When `False`, an exception is raised
* <b>`name`</b>: A name for this distribution. 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: ##### Raises:
@ -1827,7 +1831,7 @@ survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
#### `tf.contrib.distributions.Bernoulli.logits` {#Bernoulli.logits} #### `tf.contrib.distributions.Bernoulli.logits` {#Bernoulli.logits}
Log-odds of success. Log-odds of a `1` outcome (vs `0`).
- - - - - -
@ -1845,7 +1849,7 @@ Mode.
Additional documentation from `Bernoulli`: Additional documentation from `Bernoulli`:
Returns `1` if `p > 1-p` and `0` otherwise. Returns `1` if `prob > 0.5` and `0` otherwise.
- - - - - -
@ -1855,13 +1859,6 @@ Returns `1` if `p > 1-p` and `0` otherwise.
Name prepended to all ops created by this `Distribution`. Name prepended to all ops created by this `Distribution`.
- - -
#### `tf.contrib.distributions.Bernoulli.p` {#Bernoulli.p}
Probability of success.
- - - - - -
#### `tf.contrib.distributions.Bernoulli.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Bernoulli.param_shapes} #### `tf.contrib.distributions.Bernoulli.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Bernoulli.param_shapes}
@ -1992,9 +1989,9 @@ Probability density/mass function (depending on `is_continuous`).
- - - - - -
#### `tf.contrib.distributions.Bernoulli.q` {#Bernoulli.q} #### `tf.contrib.distributions.Bernoulli.probs` {#Bernoulli.probs}
1-p. Probability of a `1` outcome (vs `0`).
- - - - - -
@ -2084,19 +2081,19 @@ Variance.
- - - - - -
### `class tf.contrib.distributions.BernoulliWithSigmoidP` {#BernoulliWithSigmoidP} ### `class tf.contrib.distributions.BernoulliWithSigmoidProbs` {#BernoulliWithSigmoidProbs}
Bernoulli with `p = sigmoid(p)`. Bernoulli with `probs = nn.sigmoid(logits)`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.__init__(p=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='BernoulliWithSigmoidP')` {#BernoulliWithSigmoidP.__init__} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.__init__(logits=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='BernoulliWithSigmoidProbs')` {#BernoulliWithSigmoidProbs.__init__}
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.allow_nan_stats` {#BernoulliWithSigmoidP.allow_nan_stats} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.allow_nan_stats` {#BernoulliWithSigmoidProbs.allow_nan_stats}
Python boolean describing behavior when a stat is undefined. Python boolean describing behavior when a stat is undefined.
@ -2117,7 +2114,7 @@ undefined.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.batch_shape(name='batch_shape')` {#BernoulliWithSigmoidP.batch_shape} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.batch_shape(name='batch_shape')` {#BernoulliWithSigmoidProbs.batch_shape}
Shape of a single sample from a single event index as a 1-D `Tensor`. Shape of a single sample from a single event index as a 1-D `Tensor`.
@ -2137,7 +2134,7 @@ independent distributions of this kind the instance represents.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.cdf(value, name='cdf')` {#BernoulliWithSigmoidP.cdf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.cdf(value, name='cdf')` {#BernoulliWithSigmoidProbs.cdf}
Cumulative distribution function. Cumulative distribution function.
@ -2162,7 +2159,7 @@ cdf(x) := P[X <= x]
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.copy(**override_parameters_kwargs)` {#BernoulliWithSigmoidP.copy} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.copy(**override_parameters_kwargs)` {#BernoulliWithSigmoidProbs.copy}
Creates a deep copy of the distribution. Creates a deep copy of the distribution.
@ -2185,21 +2182,21 @@ intialization arguments.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.dtype` {#BernoulliWithSigmoidP.dtype} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.dtype` {#BernoulliWithSigmoidProbs.dtype}
The `DType` of `Tensor`s handled by this `Distribution`. The `DType` of `Tensor`s handled by this `Distribution`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.entropy(name='entropy')` {#BernoulliWithSigmoidP.entropy} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.entropy(name='entropy')` {#BernoulliWithSigmoidProbs.entropy}
Shannon entropy in nats. Shannon entropy in nats.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.event_shape(name='event_shape')` {#BernoulliWithSigmoidP.event_shape} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.event_shape(name='event_shape')` {#BernoulliWithSigmoidProbs.event_shape}
Shape of a single sample from a single batch as a 1-D int32 `Tensor`. Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
@ -2216,7 +2213,7 @@ Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.get_batch_shape()` {#BernoulliWithSigmoidP.get_batch_shape} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.get_batch_shape()` {#BernoulliWithSigmoidProbs.get_batch_shape}
Shape of a single sample from a single event index as a `TensorShape`. Shape of a single sample from a single event index as a `TensorShape`.
@ -2230,7 +2227,7 @@ Same meaning as `batch_shape`. May be only partially defined.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.get_event_shape()` {#BernoulliWithSigmoidP.get_event_shape} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.get_event_shape()` {#BernoulliWithSigmoidProbs.get_event_shape}
Shape of a single sample from a single batch as a `TensorShape`. Shape of a single sample from a single batch as a `TensorShape`.
@ -2244,14 +2241,14 @@ Same meaning as `event_shape`. May be only partially defined.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.is_continuous` {#BernoulliWithSigmoidP.is_continuous} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_continuous` {#BernoulliWithSigmoidProbs.is_continuous}
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.is_scalar_batch(name='is_scalar_batch')` {#BernoulliWithSigmoidP.is_scalar_batch} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_scalar_batch(name='is_scalar_batch')` {#BernoulliWithSigmoidProbs.is_scalar_batch}
Indicates that `batch_shape == []`. Indicates that `batch_shape == []`.
@ -2268,7 +2265,7 @@ Indicates that `batch_shape == []`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.is_scalar_event(name='is_scalar_event')` {#BernoulliWithSigmoidP.is_scalar_event} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_scalar_event(name='is_scalar_event')` {#BernoulliWithSigmoidProbs.is_scalar_event}
Indicates that `event_shape == []`. Indicates that `event_shape == []`.
@ -2285,7 +2282,7 @@ Indicates that `event_shape == []`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_cdf(value, name='log_cdf')` {#BernoulliWithSigmoidP.log_cdf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_cdf(value, name='log_cdf')` {#BernoulliWithSigmoidProbs.log_cdf}
Log cumulative distribution function. Log cumulative distribution function.
@ -2314,7 +2311,7 @@ a more accurate answer than simply taking the logarithm of the `cdf` when
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_pdf(value, name='log_pdf')` {#BernoulliWithSigmoidP.log_pdf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_pdf(value, name='log_pdf')` {#BernoulliWithSigmoidProbs.log_pdf}
Log probability density function. Log probability density function.
@ -2338,7 +2335,7 @@ Log probability density function.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_pmf(value, name='log_pmf')` {#BernoulliWithSigmoidP.log_pmf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_pmf(value, name='log_pmf')` {#BernoulliWithSigmoidProbs.log_pmf}
Log probability mass function. Log probability mass function.
@ -2362,7 +2359,7 @@ Log probability mass function.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_prob(value, name='log_prob')` {#BernoulliWithSigmoidP.log_prob} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_prob(value, name='log_prob')` {#BernoulliWithSigmoidProbs.log_prob}
Log probability density/mass function (depending on `is_continuous`). Log probability density/mass function (depending on `is_continuous`).
@ -2381,7 +2378,7 @@ Log probability density/mass function (depending on `is_continuous`).
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_survival_function(value, name='log_survival_function')` {#BernoulliWithSigmoidP.log_survival_function} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_survival_function(value, name='log_survival_function')` {#BernoulliWithSigmoidProbs.log_survival_function}
Log survival function. Log survival function.
@ -2410,46 +2407,39 @@ survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.logits` {#BernoulliWithSigmoidP.logits} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.logits` {#BernoulliWithSigmoidProbs.logits}
Log-odds of success. Log-odds of a `1` outcome (vs `0`).
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.mean(name='mean')` {#BernoulliWithSigmoidP.mean} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.mean(name='mean')` {#BernoulliWithSigmoidProbs.mean}
Mean. Mean.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.mode(name='mode')` {#BernoulliWithSigmoidP.mode} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.mode(name='mode')` {#BernoulliWithSigmoidProbs.mode}
Mode. Mode.
Additional documentation from `Bernoulli`: Additional documentation from `Bernoulli`:
Returns `1` if `p > 1-p` and `0` otherwise. Returns `1` if `prob > 0.5` and `0` otherwise.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.name` {#BernoulliWithSigmoidP.name} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.name` {#BernoulliWithSigmoidProbs.name}
Name prepended to all ops created by this `Distribution`. Name prepended to all ops created by this `Distribution`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.p` {#BernoulliWithSigmoidP.p} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#BernoulliWithSigmoidProbs.param_shapes}
Probability of success.
- - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#BernoulliWithSigmoidP.param_shapes}
Shapes of parameters given the desired shape of a call to `sample()`. Shapes of parameters given the desired shape of a call to `sample()`.
@ -2473,7 +2463,7 @@ Subclasses should override class method `_param_shapes`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.param_static_shapes(cls, sample_shape)` {#BernoulliWithSigmoidP.param_static_shapes} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.param_static_shapes(cls, sample_shape)` {#BernoulliWithSigmoidProbs.param_static_shapes}
param_shapes with static (i.e. `TensorShape`) shapes. param_shapes with static (i.e. `TensorShape`) shapes.
@ -2503,14 +2493,14 @@ constant-valued tensors when constant values are fed.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.parameters` {#BernoulliWithSigmoidP.parameters} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.parameters` {#BernoulliWithSigmoidProbs.parameters}
Dictionary of parameters used to instantiate this `Distribution`. Dictionary of parameters used to instantiate this `Distribution`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.pdf(value, name='pdf')` {#BernoulliWithSigmoidP.pdf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.pdf(value, name='pdf')` {#BernoulliWithSigmoidProbs.pdf}
Probability density function. Probability density function.
@ -2534,7 +2524,7 @@ Probability density function.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.pmf(value, name='pmf')` {#BernoulliWithSigmoidP.pmf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.pmf(value, name='pmf')` {#BernoulliWithSigmoidProbs.pmf}
Probability mass function. Probability mass function.
@ -2558,7 +2548,7 @@ Probability mass function.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.prob(value, name='prob')` {#BernoulliWithSigmoidP.prob} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.prob(value, name='prob')` {#BernoulliWithSigmoidProbs.prob}
Probability density/mass function (depending on `is_continuous`). Probability density/mass function (depending on `is_continuous`).
@ -2577,14 +2567,14 @@ Probability density/mass function (depending on `is_continuous`).
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.q` {#BernoulliWithSigmoidP.q} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.probs` {#BernoulliWithSigmoidProbs.probs}
1-p. Probability of a `1` outcome (vs `0`).
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.reparameterization_type` {#BernoulliWithSigmoidP.reparameterization_type} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.reparameterization_type` {#BernoulliWithSigmoidProbs.reparameterization_type}
Describes how samples from the distribution are reparameterized. Describes how samples from the distribution are reparameterized.
@ -2599,7 +2589,7 @@ or `distributions.NOT_REPARAMETERIZED`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.sample(sample_shape=(), seed=None, name='sample')` {#BernoulliWithSigmoidP.sample} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.sample(sample_shape=(), seed=None, name='sample')` {#BernoulliWithSigmoidProbs.sample}
Generate samples of the specified shape. Generate samples of the specified shape.
@ -2621,14 +2611,14 @@ sample.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.stddev(name='stddev')` {#BernoulliWithSigmoidP.stddev} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.stddev(name='stddev')` {#BernoulliWithSigmoidProbs.stddev}
Standard deviation. Standard deviation.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.survival_function(value, name='survival_function')` {#BernoulliWithSigmoidP.survival_function} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.survival_function(value, name='survival_function')` {#BernoulliWithSigmoidProbs.survival_function}
Survival function. Survival function.
@ -2654,14 +2644,14 @@ survival_function(x) = P[X > x]
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.validate_args` {#BernoulliWithSigmoidP.validate_args} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.validate_args` {#BernoulliWithSigmoidProbs.validate_args}
Python boolean indicated possibly expensive checks are enabled. Python boolean indicated possibly expensive checks are enabled.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.variance(name='variance')` {#BernoulliWithSigmoidP.variance} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.variance(name='variance')` {#BernoulliWithSigmoidProbs.variance}
Variance. Variance.
@ -3980,7 +3970,7 @@ drawn from.
```python ```python
p = [0.1, 0.5, 0.4] p = [0.1, 0.5, 0.4]
dist = Categorical(p=p) dist = Categorical(probs=p)
``` ```
Creates a 3-class distiribution, with the 2nd class the most likely to be Creates a 3-class distiribution, with the 2nd class the most likely to be
@ -3997,7 +3987,7 @@ The distribution functions can be evaluated on counts.
```python ```python
# counts is a scalar. # counts is a scalar.
p = [0.1, 0.4, 0.5] p = [0.1, 0.4, 0.5]
dist = Categorical(p=p) dist = Categorical(probs=p)
dist.pmf(0) # Shape [] dist.pmf(0) # Shape []
# p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match counts. # p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match counts.
@ -4010,7 +4000,7 @@ dist.pmf(counts) # Shape [5, 7, 3]
``` ```
- - - - - -
#### `tf.contrib.distributions.Categorical.__init__(logits=None, p=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Categorical')` {#Categorical.__init__} #### `tf.contrib.distributions.Categorical.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Categorical')` {#Categorical.__init__}
Initialize Categorical distributions using class log-probabilities. Initialize Categorical distributions using class log-probabilities.
@ -4018,22 +4008,25 @@ Initialize Categorical distributions using class log-probabilities.
* <b>`logits`</b>: An N-D `Tensor`, `N >= 1`, representing the log probabilities * <b>`logits`</b>: An N-D `Tensor`, `N >= 1`, representing the log probabilities
of a set of Categorical distributions. The first `N - 1` dimensions of a set of Categorical distributions. The first `N - 1` dimensions
index into a batch of independent distributions and the last dimension index into a batch of independent distributions and the last dimension
represents a vector of logits for each class. Only one of `logits` or represents a vector of logits for each class. Only one of `logits` or
`p` should be passed in. `probs` should be passed in.
* <b>`p`</b>: An N-D `Tensor`, `N >= 1`, representing the probabilities * <b>`probs`</b>: An N-D `Tensor`, `N >= 1`, representing the probabilities
of a set of Categorical distributions. The first `N - 1` dimensions of a set of Categorical distributions. The first `N - 1` dimensions
index into a batch of independent distributions and the last dimension index into a batch of independent distributions and the last dimension
represents a vector of probabilities for each class. Only one of represents a vector of probabilities for each class. Only one of
`logits` or `p` should be passed in. `logits` or `probs` should be passed in.
* <b>`dtype`</b>: The type of the event samples (default: int32). * <b>`dtype`</b>: The type of the event samples (default: int32).
* <b>`validate_args`</b>: Unused in this distribution. * <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an parameters are checked for validity despite possibly degrading runtime
exception if a statistic (e.g. mean/mode/etc...) is undefined for any performance. When `False` invalid inputs may silently render incorrect
batch member. If `True`, batch members with valid parameters leading to outputs.
undefined statistics will return NaN for this statistic. * <b>`allow_nan_stats`</b>: Python `Boolean`, default `True`. When `True`, statistics
* <b>`name`</b>: A name for this distribution (optional). (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.
- - - - - -
@ -4385,15 +4378,6 @@ Name prepended to all ops created by this `Distribution`.
Scalar `int32` tensor: the number of classes. Scalar `int32` tensor: the number of classes.
- - -
#### `tf.contrib.distributions.Categorical.p` {#Categorical.p}
Vector of probabilities summing to one.
Each element is the probability of drawing that coordinate.
- - - - - -
#### `tf.contrib.distributions.Categorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Categorical.param_shapes} #### `tf.contrib.distributions.Categorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Categorical.param_shapes}
@ -4522,6 +4506,15 @@ Probability density/mass function (depending on `is_continuous`).
values of type `self.dtype`. values of type `self.dtype`.
- - -
#### `tf.contrib.distributions.Categorical.probs` {#Categorical.probs}
Vector of probabilities summing to one.
Each element is the probability of drawing that coordinate.
- - - - - -
#### `tf.contrib.distributions.Categorical.reparameterization_type` {#Categorical.reparameterization_type} #### `tf.contrib.distributions.Categorical.reparameterization_type` {#Categorical.reparameterization_type}
@ -19248,36 +19241,50 @@ Cov(X_i, X_j) = -n * alpha_i * alpha_j / alpha_0 ** 2 *
Multinomial distribution. Multinomial distribution.
This distribution is parameterized by a vector `p` of probability This Multinomial distribution is parameterized by `probs`, a (batch of)
parameters for `k` classes and `n`, the counts per each class.. 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 #### Mathematical Details
The Multinomial is a distribution over k-class count data, meaning The Multinomial is a distribution over `k`-class counts, i.e., a length-`k`
for each k-tuple of non-negative integer `counts = [n_1,...,n_k]`, we have a vector of non-negative integer `counts = n = [n_0, ..., n_{k-1}]`.
probability of these draws being made from the distribution. The distribution
has hyperparameters `p = (p_1,...,p_k)`, and probability mass
function (pmf):
```pmf(counts) = n! / (n_1!...n_k!) * (p_1)^n_1*(p_2)^n_2*...(p_k)^n_k``` The probability mass function (pmf) is,
where above `n = sum_j n_j`, `n!` is `n` factorial. ```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.
#### Examples #### Examples
Create a 3-class distribution, with the 3rd class is most likely to be drawn, Create a 3-class distribution, with the 3rd class is most likely to be drawn,
using logits.. using logits.
```python ```python
logits = [-50., -43, 0] logits = [-50., -43, 0]
dist = Multinomial(n=4., logits=logits) dist = Multinomial(total_count=4., logits=logits)
``` ```
Create a 3-class distribution, with the 3rd class is most likely to be drawn. Create a 3-class distribution, with the 3rd class is most likely to be drawn.
```python ```python
p = [.2, .3, .5] p = [.2, .3, .5]
dist = Multinomial(n=4., p=p) dist = Multinomial(total_count=4., probs=p)
``` ```
The distribution functions can be evaluated on counts. The distribution functions can be evaluated on counts.
@ -19300,54 +19307,43 @@ Create a 2-batch of 3-class distributions.
```python ```python
p = [[.1, .2, .7], [.3, .3, .4]] # Shape [2, 3] p = [[.1, .2, .7], [.3, .3, .4]] # Shape [2, 3]
dist = Multinomial(n=[4., 5], p=p) dist = Multinomial(total_count=[4., 5], probs=p)
counts = [[2., 1, 1], [3, 1, 1]] counts = [[2., 1, 1], [3, 1, 1]]
dist.prob(counts) # Shape [2] dist.prob(counts) # Shape [2]
``` ```
- - - - - -
#### `tf.contrib.distributions.Multinomial.__init__(n, logits=None, p=None, validate_args=False, allow_nan_stats=True, name='Multinomial')` {#Multinomial.__init__} #### `tf.contrib.distributions.Multinomial.__init__(total_count, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='Multinomial')` {#Multinomial.__init__}
Initialize a batch of Multinomial distributions. Initialize a batch of Multinomial distributions.
##### Args: ##### Args:
* <b>`n`</b>: Non-negative floating point tensor with shape broadcastable to * <b>`total_count`</b>: Non-negative floating point tensor with shape broadcastable
`[N1,..., Nm]` with `m >= 0`. Defines this as a batch of to `[N1,..., Nm]` with `m >= 0`. Defines this as a batch of
`N1 x ... x Nm` different Multinomial distributions. Its components `N1 x ... x Nm` different Multinomial distributions. Its components
should be equal to integer values. should be equal to integer values.
* <b>`logits`</b>: Floating point tensor representing the log-odds of a * <b>`logits`</b>: Floating point tensor representing the log-odds of a
positive event with shape broadcastable to `[N1,..., Nm, k], m >= 0`, positive event with shape broadcastable to `[N1,..., Nm, k], m >= 0`,
and the same dtype as `n`. Defines this as a batch of `N1 x ... x Nm` and the same dtype as `total_count`. Defines this as a batch of
different `k` class Multinomial distributions. Only one of `logits` or `N1 x ... x Nm` different `k` class Multinomial distributions. Only one
`p` should be passed in. of `logits` or `probs` should be passed in.
* <b>`p`</b>: Positive floating point tensor with shape broadcastable to * <b>`probs`</b>: Positive floating point tensor with shape broadcastable to
`[N1,..., Nm, k]` `m >= 0` and same dtype as `n`. Defines this as `[N1,..., Nm, k]` `m >= 0` and same dtype as `total_count`. Defines
a batch of `N1 x ... x Nm` different `k` class Multinomial this as a batch of `N1 x ... x Nm` different `k` class Multinomial
distributions. `p`'s components in the last portion of its shape should distributions. `probs`'s components in the last portion of its shape
sum up to 1. Only one of `logits` or `p` should be passed in. should sum to `1`. Only one of `logits` or `probs` should be passed in.
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to assert valid * <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
values for parameters `n` and `p`, and `x` in `prob` and `log_prob`. parameters are checked for validity despite possibly degrading runtime
If `False`, correct behavior is not guaranteed. performance. When `False` invalid inputs may silently render incorrect
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an outputs.
exception if a statistic (e.g. mean/mode/etc...) is undefined for any * <b>`allow_nan_stats`</b>: Python `Boolean`, default `True`. When `True`, statistics
batch member. If `True`, batch members with valid parameters leading to (e.g., mean, mode, variance) use the value "`NaN`" to indicate the
undefined statistics will return NaN for this statistic. result is undefined. When `False`, an exception is raised if one or
* <b>`name`</b>: The name to prefix Ops created by this distribution class. more of the statistic's batch members are undefined.
* <b>`name`</b>: `String` name prefixed to Ops created by this class.
* <b>`Examples`</b>:
```python
# Define 1-batch of 2-class multinomial distribution,
# also known as a Binomial distribution.
dist = Multinomial(n=2., p=[.1, .9])
# Define a 2-batch of 3-class distributions.
dist = Multinomial(n=[4., 5], p=[[.1, .3, .6], [.4, .05, .55]])
```
- - - - - -
@ -19625,17 +19621,18 @@ Log probability density/mass function (depending on `is_continuous`).
Additional documentation from `Multinomial`: Additional documentation from `Multinomial`:
For each batch of counts `[n_1,...,n_k]`, `P[counts]` is the probability For each batch of counts, `value = [n_0, ...
that after sampling `n` draws from this Multinomial distribution, the ,n_{k-1}]`, `P[value]` is the probability that after sampling `self.total_count`
number of draws falling in class `j` is `n_j`. Note that different draws from this Multinomial distribution, the number of draws falling in class
sequences of draws can result in the same counts, thus the probability `j` is `n_j`. Since this definition is [exchangeable](
includes a combinatorial coefficient. https://en.wikipedia.org/wiki/Exchangeable_random_variables); different
sequences have the same counts so the probability includes a combinatorial
coefficient.
Note that input "counts" must be a non-negative tensor with dtype `dtype` Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no
and whose shape can be broadcast with `self.p` and `self.n`. For fixed fractional components, and such that
leading dimensions, the last dimension represents counts for the `tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable
corresponding Multinomial distribution in `self.p`. `counts` is only legal with `self.probs` and `self.total_count`.
if it sums up to `n` and its components are equal to integer values.
##### Args: ##### Args:
@ -19700,13 +19697,6 @@ Mean.
Mode. Mode.
- - -
#### `tf.contrib.distributions.Multinomial.n` {#Multinomial.n}
Number of trials.
- - - - - -
#### `tf.contrib.distributions.Multinomial.name` {#Multinomial.name} #### `tf.contrib.distributions.Multinomial.name` {#Multinomial.name}
@ -19714,15 +19704,6 @@ Number of trials.
Name prepended to all ops created by this `Distribution`. Name prepended to all ops created by this `Distribution`.
- - -
#### `tf.contrib.distributions.Multinomial.p` {#Multinomial.p}
Vector of probabilities summing to one.
Each element is the probability of drawing that coordinate.
- - - - - -
#### `tf.contrib.distributions.Multinomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Multinomial.param_shapes} #### `tf.contrib.distributions.Multinomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Multinomial.param_shapes}
@ -19841,17 +19822,18 @@ Probability density/mass function (depending on `is_continuous`).
Additional documentation from `Multinomial`: Additional documentation from `Multinomial`:
For each batch of counts `[n_1,...,n_k]`, `P[counts]` is the probability For each batch of counts, `value = [n_0, ...
that after sampling `n` draws from this Multinomial distribution, the ,n_{k-1}]`, `P[value]` is the probability that after sampling `self.total_count`
number of draws falling in class `j` is `n_j`. Note that different draws from this Multinomial distribution, the number of draws falling in class
sequences of draws can result in the same counts, thus the probability `j` is `n_j`. Since this definition is [exchangeable](
includes a combinatorial coefficient. https://en.wikipedia.org/wiki/Exchangeable_random_variables); different
sequences have the same counts so the probability includes a combinatorial
coefficient.
Note that input "counts" must be a non-negative tensor with dtype `dtype` Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no
and whose shape can be broadcast with `self.p` and `self.n`. For fixed fractional components, and such that
leading dimensions, the last dimension represents counts for the `tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable
corresponding Multinomial distribution in `self.p`. `counts` is only legal with `self.probs` and `self.total_count`.
if it sums up to `n` and its components are equal to integer values.
##### Args: ##### Args:
@ -19866,6 +19848,15 @@ if it sums up to `n` and its components are equal to integer values.
values of type `self.dtype`. values of type `self.dtype`.
- - -
#### `tf.contrib.distributions.Multinomial.probs` {#Multinomial.probs}
Vector of probabilities summing to one.
Each element is the probability of drawing that coordinate.
- - - - - -
#### `tf.contrib.distributions.Multinomial.reparameterization_type` {#Multinomial.reparameterization_type} #### `tf.contrib.distributions.Multinomial.reparameterization_type` {#Multinomial.reparameterization_type}
@ -19936,6 +19927,13 @@ survival_function(x) = P[X > x]
`self.dtype`. `self.dtype`.
- - -
#### `tf.contrib.distributions.Multinomial.total_count` {#Multinomial.total_count}
Number of trials used to construct a sample.
- - - - - -
#### `tf.contrib.distributions.Multinomial.validate_args` {#Multinomial.validate_args} #### `tf.contrib.distributions.Multinomial.validate_args` {#Multinomial.validate_args}

View File

@ -1,33 +1,34 @@
Bernoulli distribution. Bernoulli distribution.
The Bernoulli distribution is parameterized by p, the probability of a The Bernoulli distribution with `probs` parameter, i.e., the probability of a
positive event. `1` outcome (vs a `0` outcome).
- - - - - -
#### `tf.contrib.distributions.Bernoulli.__init__(logits=None, p=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Bernoulli')` {#Bernoulli.__init__} #### `tf.contrib.distributions.Bernoulli.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Bernoulli')` {#Bernoulli.__init__}
Construct Bernoulli distributions. Construct Bernoulli distributions.
##### Args: ##### Args:
* <b>`logits`</b>: An N-D `Tensor` representing the log-odds * <b>`logits`</b>: An N-D `Tensor` representing the log-odds of a `1` event. Each
of a positive event. Each entry in the `Tensor` parametrizes entry in the `Tensor` parametrizes an independent Bernoulli distribution
an independent Bernoulli distribution where the probability of an event where the probability of an event is sigmoid(logits). Only one of
is sigmoid(logits). Only one of `logits` or `p` should be passed in. `logits` or `probs` should be passed in.
* <b>`p`</b>: An N-D `Tensor` representing the probability of a positive * <b>`probs`</b>: An N-D `Tensor` representing the probability of a `1`
event. Each entry in the `Tensor` parameterizes an independent event. Each entry in the `Tensor` parameterizes an independent
Bernoulli distribution. Only one of `logits` or `p` should be passed Bernoulli distribution. Only one of `logits` or `probs` should be passed
in. in.
* <b>`dtype`</b>: dtype for samples. * <b>`dtype`</b>: The type of the event samples. Default: `int32`.
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to validate that * <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
`0 <= p <= 1`. If `validate_args` is `False`, and the inputs are parameters are checked for validity despite possibly degrading runtime
invalid, methods like `log_pmf` may return `NaN` values. performance. When `False` invalid inputs may silently render incorrect
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an outputs.
exception if a statistic (e.g. mean/mode/etc...) is undefined for any * <b>`allow_nan_stats`</b>: Python `Boolean`, default `True`. When `True`,
batch member. If `True`, batch members with valid parameters leading to statistics (e.g., mean, mode, variance) use the value "`NaN`" to
undefined statistics will return NaN for this statistic. indicate the result is undefined. When `False`, an exception is raised
* <b>`name`</b>: A name for this distribution. 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: ##### Raises:
@ -353,7 +354,7 @@ survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
#### `tf.contrib.distributions.Bernoulli.logits` {#Bernoulli.logits} #### `tf.contrib.distributions.Bernoulli.logits` {#Bernoulli.logits}
Log-odds of success. Log-odds of a `1` outcome (vs `0`).
- - - - - -
@ -371,7 +372,7 @@ Mode.
Additional documentation from `Bernoulli`: Additional documentation from `Bernoulli`:
Returns `1` if `p > 1-p` and `0` otherwise. Returns `1` if `prob > 0.5` and `0` otherwise.
- - - - - -
@ -381,13 +382,6 @@ Returns `1` if `p > 1-p` and `0` otherwise.
Name prepended to all ops created by this `Distribution`. Name prepended to all ops created by this `Distribution`.
- - -
#### `tf.contrib.distributions.Bernoulli.p` {#Bernoulli.p}
Probability of success.
- - - - - -
#### `tf.contrib.distributions.Bernoulli.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Bernoulli.param_shapes} #### `tf.contrib.distributions.Bernoulli.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Bernoulli.param_shapes}
@ -518,9 +512,9 @@ Probability density/mass function (depending on `is_continuous`).
- - - - - -
#### `tf.contrib.distributions.Bernoulli.q` {#Bernoulli.q} #### `tf.contrib.distributions.Bernoulli.probs` {#Bernoulli.probs}
1-p. Probability of a `1` outcome (vs `0`).
- - - - - -

View File

@ -10,7 +10,7 @@ drawn from.
```python ```python
p = [0.1, 0.5, 0.4] p = [0.1, 0.5, 0.4]
dist = Categorical(p=p) dist = Categorical(probs=p)
``` ```
Creates a 3-class distiribution, with the 2nd class the most likely to be Creates a 3-class distiribution, with the 2nd class the most likely to be
@ -27,7 +27,7 @@ The distribution functions can be evaluated on counts.
```python ```python
# counts is a scalar. # counts is a scalar.
p = [0.1, 0.4, 0.5] p = [0.1, 0.4, 0.5]
dist = Categorical(p=p) dist = Categorical(probs=p)
dist.pmf(0) # Shape [] dist.pmf(0) # Shape []
# p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match counts. # p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match counts.
@ -40,7 +40,7 @@ dist.pmf(counts) # Shape [5, 7, 3]
``` ```
- - - - - -
#### `tf.contrib.distributions.Categorical.__init__(logits=None, p=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Categorical')` {#Categorical.__init__} #### `tf.contrib.distributions.Categorical.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Categorical')` {#Categorical.__init__}
Initialize Categorical distributions using class log-probabilities. Initialize Categorical distributions using class log-probabilities.
@ -48,22 +48,25 @@ Initialize Categorical distributions using class log-probabilities.
* <b>`logits`</b>: An N-D `Tensor`, `N >= 1`, representing the log probabilities * <b>`logits`</b>: An N-D `Tensor`, `N >= 1`, representing the log probabilities
of a set of Categorical distributions. The first `N - 1` dimensions of a set of Categorical distributions. The first `N - 1` dimensions
index into a batch of independent distributions and the last dimension index into a batch of independent distributions and the last dimension
represents a vector of logits for each class. Only one of `logits` or represents a vector of logits for each class. Only one of `logits` or
`p` should be passed in. `probs` should be passed in.
* <b>`p`</b>: An N-D `Tensor`, `N >= 1`, representing the probabilities * <b>`probs`</b>: An N-D `Tensor`, `N >= 1`, representing the probabilities
of a set of Categorical distributions. The first `N - 1` dimensions of a set of Categorical distributions. The first `N - 1` dimensions
index into a batch of independent distributions and the last dimension index into a batch of independent distributions and the last dimension
represents a vector of probabilities for each class. Only one of represents a vector of probabilities for each class. Only one of
`logits` or `p` should be passed in. `logits` or `probs` should be passed in.
* <b>`dtype`</b>: The type of the event samples (default: int32). * <b>`dtype`</b>: The type of the event samples (default: int32).
* <b>`validate_args`</b>: Unused in this distribution. * <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an parameters are checked for validity despite possibly degrading runtime
exception if a statistic (e.g. mean/mode/etc...) is undefined for any performance. When `False` invalid inputs may silently render incorrect
batch member. If `True`, batch members with valid parameters leading to outputs.
undefined statistics will return NaN for this statistic. * <b>`allow_nan_stats`</b>: Python `Boolean`, default `True`. When `True`, statistics
* <b>`name`</b>: A name for this distribution (optional). (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.
- - - - - -
@ -415,15 +418,6 @@ Name prepended to all ops created by this `Distribution`.
Scalar `int32` tensor: the number of classes. Scalar `int32` tensor: the number of classes.
- - -
#### `tf.contrib.distributions.Categorical.p` {#Categorical.p}
Vector of probabilities summing to one.
Each element is the probability of drawing that coordinate.
- - - - - -
#### `tf.contrib.distributions.Categorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Categorical.param_shapes} #### `tf.contrib.distributions.Categorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Categorical.param_shapes}
@ -552,6 +546,15 @@ Probability density/mass function (depending on `is_continuous`).
values of type `self.dtype`. values of type `self.dtype`.
- - -
#### `tf.contrib.distributions.Categorical.probs` {#Categorical.probs}
Vector of probabilities summing to one.
Each element is the probability of drawing that coordinate.
- - - - - -
#### `tf.contrib.distributions.Categorical.reparameterization_type` {#Categorical.reparameterization_type} #### `tf.contrib.distributions.Categorical.reparameterization_type` {#Categorical.reparameterization_type}

View File

@ -1,28 +1,40 @@
Binomial distribution. Binomial distribution.
This distribution is parameterized by a vector `p` of probabilities and `n`, This distribution is parameterized by `probs`, a (batch of) probabilities for
the total counts. drawing a `1` and `total_count`, the number of trials per draw from the
Binomial.
#### Mathematical details #### Mathematical Details
The Binomial is a distribution over the number of successes in `n` independent The Binomial is a distribution over the number of `1`'s in `total_count`
trials, with each trial having the same probability of success `p`. independent trials, with each trial having the same probability of `1`, i.e.,
The probability mass function (pmf): `probs`.
```pmf(k) = n! / (k! * (n - k)!) * (p)^k * (1 - p)^(n - k)``` The probability mass function (pmf) is,
```none
pmf(k; n, p) = p**k (1 - p)**(n - k) / Z
Z = k! (n - k)! / n!
```
where:
* `total_count = n`,
* `probs = p`,
* `Z` is the normalizaing constant, and,
* `n!` is the factorial of `n`.
#### Examples #### Examples
Create a single distribution, corresponding to 5 coin flips. Create a single distribution, corresponding to 5 coin flips.
```python ```python
dist = Binomial(n=5., p=.5) dist = Binomial(total_count=5., probs=.5)
``` ```
Create a single distribution (using logits), corresponding to 5 coin flips. Create a single distribution (using logits), corresponding to 5 coin flips.
```python ```python
dist = Binomial(n=5., logits=0.) dist = Binomial(total_count=5., logits=0.)
``` ```
Creates 3 distributions with the third distribution most likely to have Creates 3 distributions with the third distribution most likely to have
@ -31,7 +43,7 @@ successes.
```python ```python
p = [.2, .3, .8] p = [.2, .3, .8]
# n will be broadcast to [4., 4., 4.], to match p. # n will be broadcast to [4., 4., 4.], to match p.
dist = Binomial(n=4., p=p) dist = Binomial(total_count=4., probs=p)
``` ```
The distribution functions can be evaluated on counts. The distribution functions can be evaluated on counts.
@ -51,45 +63,35 @@ dist.prob(counts) # Shape [5, 7, 3]
``` ```
- - - - - -
#### `tf.contrib.distributions.Binomial.__init__(n, logits=None, p=None, validate_args=False, allow_nan_stats=True, name='Binomial')` {#Binomial.__init__} #### `tf.contrib.distributions.Binomial.__init__(total_count, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='Binomial')` {#Binomial.__init__}
Initialize a batch of Binomial distributions. Initialize a batch of Binomial distributions.
##### Args: ##### Args:
* <b>`n`</b>: Non-negative floating point tensor with shape broadcastable to * <b>`total_count`</b>: Non-negative floating point tensor with shape broadcastable
`[N1,..., Nm]` with `m >= 0` and the same dtype as `p` or `logits`. to `[N1,..., Nm]` with `m >= 0` and the same dtype as `probs` or
Defines this as a batch of `N1 x ... x Nm` different Binomial `logits`. Defines this as a batch of `N1 x ... x Nm` different Binomial
distributions. Its components should be equal to integer values. distributions. Its components should be equal to integer values.
* <b>`logits`</b>: Floating point tensor representing the log-odds of a * <b>`logits`</b>: Floating point tensor representing the log-odds of a
positive event with shape broadcastable to `[N1,..., Nm]` `m >= 0`, and positive event with shape broadcastable to `[N1,..., Nm]` `m >= 0`, and
the same dtype as `n`. Each entry represents logits for the probability the same dtype as `total_count`. Each entry represents logits for the
of success for independent Binomial distributions. Only one of
`logits` or `p` should be passed in.
* <b>`p`</b>: Positive floating point tensor with shape broadcastable to
`[N1,..., Nm]` `m >= 0`, `p in [0, 1]`. Each entry represents the
probability of success for independent Binomial distributions. Only one probability of success for independent Binomial distributions. Only one
of `logits` or `p` should be passed in. of `logits` or `probs` should be passed in.
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to assert valid values * <b>`probs`</b>: Positive floating point tensor with shape broadcastable to
for parameters `n`, `p`, and `x` in `prob` and `log_prob`. `[N1,..., Nm]` `m >= 0`, `probs in [0, 1]`. Each entry represents the
If `False` and inputs are invalid, correct behavior is not guaranteed. probability of success for independent Binomial distributions. Only one
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an of `logits` or `probs` should be passed in.
exception if a statistic (e.g. mean/mode/etc...) is undefined for any * <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
batch member. If `True`, batch members with valid parameters leading to parameters are checked for validity despite possibly degrading runtime
undefined statistics will return NaN for this statistic. performance. When `False` invalid inputs may silently render incorrect
* <b>`name`</b>: The name to prefix Ops created by this distribution class. 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
* <b>`Examples`</b>: result is undefined. When `False`, an exception is raised if one or
more of the statistic's batch members are undefined.
```python * <b>`name`</b>: `String` name prefixed to Ops created by this class.
# Define 1-batch of a binomial distribution.
dist = Binomial(n=2., p=.9)
# Define a 2-batch.
dist = Binomial(n=[4., 5], p=[.1, .3])
```
- - - - - -
@ -367,15 +369,15 @@ Log probability density/mass function (depending on `is_continuous`).
Additional documentation from `Binomial`: Additional documentation from `Binomial`:
For each batch member of counts `value`, `P[counts]` is the probability that For each batch member of counts `value`, `P[value]` is the probability that
after sampling `n` draws from this Binomial distribution, the number of after sampling `self.total_count` draws from this Binomial distribution, the
successes is `k`. Note that different sequences of draws can result in the number of successes is `value`. Since different sequences of draws can result in
same counts, thus the probability includes a combinatorial coefficient. the same counts, the probability includes a combinatorial coefficient.
`value` must be a non-negative tensor with dtype `dtype` and whose shape Note: `value` must be a non-negative tensor with dtype `dtype` and whose shape
can be broadcast with `self.p` and `self.n`. `counts` is only legal if it is can be broadcast with `self.probs` and `self.total_count`. `value` is only legal
less than or equal to `n` and its components are equal to integer if it is less than or equal to `self.total_count` and its components are equal
values. to integer values.
##### Args: ##### Args:
@ -423,7 +425,7 @@ survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
#### `tf.contrib.distributions.Binomial.logits` {#Binomial.logits} #### `tf.contrib.distributions.Binomial.logits` {#Binomial.logits}
Log-odds of success. Log-odds of drawing a `1`.
- - - - - -
@ -441,16 +443,10 @@ Mode.
Additional documentation from `Binomial`: Additional documentation from `Binomial`:
Note that when `(n + 1) * p` is an integer, there are actually two Note that when `(1 + total_count) * probs` is an integer, there are
modes. Namely, `(n + 1) * p` and `(n + 1) * p - 1` are both modes. Here actually two modes. Namely, `(1 + total_count) * probs` and
we return only the larger of the two modes. `(1 + total_count) * probs - 1` are both modes. Here we return only the
larger of the two modes.
- - -
#### `tf.contrib.distributions.Binomial.n` {#Binomial.n}
Number of trials.
- - - - - -
@ -460,13 +456,6 @@ Number of trials.
Name prepended to all ops created by this `Distribution`. Name prepended to all ops created by this `Distribution`.
- - -
#### `tf.contrib.distributions.Binomial.p` {#Binomial.p}
Probability of success.
- - - - - -
#### `tf.contrib.distributions.Binomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Binomial.param_shapes} #### `tf.contrib.distributions.Binomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Binomial.param_shapes}
@ -585,15 +574,15 @@ Probability density/mass function (depending on `is_continuous`).
Additional documentation from `Binomial`: Additional documentation from `Binomial`:
For each batch member of counts `value`, `P[counts]` is the probability that For each batch member of counts `value`, `P[value]` is the probability that
after sampling `n` draws from this Binomial distribution, the number of after sampling `self.total_count` draws from this Binomial distribution, the
successes is `k`. Note that different sequences of draws can result in the number of successes is `value`. Since different sequences of draws can result in
same counts, thus the probability includes a combinatorial coefficient. the same counts, the probability includes a combinatorial coefficient.
`value` must be a non-negative tensor with dtype `dtype` and whose shape Note: `value` must be a non-negative tensor with dtype `dtype` and whose shape
can be broadcast with `self.p` and `self.n`. `counts` is only legal if it is can be broadcast with `self.probs` and `self.total_count`. `value` is only legal
less than or equal to `n` and its components are equal to integer if it is less than or equal to `self.total_count` and its components are equal
values. to integer values.
##### Args: ##### Args:
@ -608,6 +597,13 @@ values.
values of type `self.dtype`. values of type `self.dtype`.
- - -
#### `tf.contrib.distributions.Binomial.probs` {#Binomial.probs}
Probability of of drawing a `1`.
- - - - - -
#### `tf.contrib.distributions.Binomial.reparameterization_type` {#Binomial.reparameterization_type} #### `tf.contrib.distributions.Binomial.reparameterization_type` {#Binomial.reparameterization_type}
@ -678,6 +674,13 @@ survival_function(x) = P[X > x]
`self.dtype`. `self.dtype`.
- - -
#### `tf.contrib.distributions.Binomial.total_count` {#Binomial.total_count}
Number of trials.
- - - - - -
#### `tf.contrib.distributions.Binomial.validate_args` {#Binomial.validate_args} #### `tf.contrib.distributions.Binomial.validate_args` {#Binomial.validate_args}

View File

@ -1,35 +1,49 @@
Multinomial distribution. Multinomial distribution.
This distribution is parameterized by a vector `p` of probability This Multinomial distribution is parameterized by `probs`, a (batch of)
parameters for `k` classes and `n`, the counts per each class.. 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 #### Mathematical Details
The Multinomial is a distribution over k-class count data, meaning The Multinomial is a distribution over `k`-class counts, i.e., a length-`k`
for each k-tuple of non-negative integer `counts = [n_1,...,n_k]`, we have a vector of non-negative integer `counts = n = [n_0, ..., n_{k-1}]`.
probability of these draws being made from the distribution. The distribution
has hyperparameters `p = (p_1,...,p_k)`, and probability mass
function (pmf):
```pmf(counts) = n! / (n_1!...n_k!) * (p_1)^n_1*(p_2)^n_2*...(p_k)^n_k``` The probability mass function (pmf) is,
where above `n = sum_j n_j`, `n!` is `n` factorial. ```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.
#### Examples #### Examples
Create a 3-class distribution, with the 3rd class is most likely to be drawn, Create a 3-class distribution, with the 3rd class is most likely to be drawn,
using logits.. using logits.
```python ```python
logits = [-50., -43, 0] logits = [-50., -43, 0]
dist = Multinomial(n=4., logits=logits) dist = Multinomial(total_count=4., logits=logits)
``` ```
Create a 3-class distribution, with the 3rd class is most likely to be drawn. Create a 3-class distribution, with the 3rd class is most likely to be drawn.
```python ```python
p = [.2, .3, .5] p = [.2, .3, .5]
dist = Multinomial(n=4., p=p) dist = Multinomial(total_count=4., probs=p)
``` ```
The distribution functions can be evaluated on counts. The distribution functions can be evaluated on counts.
@ -52,54 +66,43 @@ Create a 2-batch of 3-class distributions.
```python ```python
p = [[.1, .2, .7], [.3, .3, .4]] # Shape [2, 3] p = [[.1, .2, .7], [.3, .3, .4]] # Shape [2, 3]
dist = Multinomial(n=[4., 5], p=p) dist = Multinomial(total_count=[4., 5], probs=p)
counts = [[2., 1, 1], [3, 1, 1]] counts = [[2., 1, 1], [3, 1, 1]]
dist.prob(counts) # Shape [2] dist.prob(counts) # Shape [2]
``` ```
- - - - - -
#### `tf.contrib.distributions.Multinomial.__init__(n, logits=None, p=None, validate_args=False, allow_nan_stats=True, name='Multinomial')` {#Multinomial.__init__} #### `tf.contrib.distributions.Multinomial.__init__(total_count, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='Multinomial')` {#Multinomial.__init__}
Initialize a batch of Multinomial distributions. Initialize a batch of Multinomial distributions.
##### Args: ##### Args:
* <b>`n`</b>: Non-negative floating point tensor with shape broadcastable to * <b>`total_count`</b>: Non-negative floating point tensor with shape broadcastable
`[N1,..., Nm]` with `m >= 0`. Defines this as a batch of to `[N1,..., Nm]` with `m >= 0`. Defines this as a batch of
`N1 x ... x Nm` different Multinomial distributions. Its components `N1 x ... x Nm` different Multinomial distributions. Its components
should be equal to integer values. should be equal to integer values.
* <b>`logits`</b>: Floating point tensor representing the log-odds of a * <b>`logits`</b>: Floating point tensor representing the log-odds of a
positive event with shape broadcastable to `[N1,..., Nm, k], m >= 0`, positive event with shape broadcastable to `[N1,..., Nm, k], m >= 0`,
and the same dtype as `n`. Defines this as a batch of `N1 x ... x Nm` and the same dtype as `total_count`. Defines this as a batch of
different `k` class Multinomial distributions. Only one of `logits` or `N1 x ... x Nm` different `k` class Multinomial distributions. Only one
`p` should be passed in. of `logits` or `probs` should be passed in.
* <b>`p`</b>: Positive floating point tensor with shape broadcastable to * <b>`probs`</b>: Positive floating point tensor with shape broadcastable to
`[N1,..., Nm, k]` `m >= 0` and same dtype as `n`. Defines this as `[N1,..., Nm, k]` `m >= 0` and same dtype as `total_count`. Defines
a batch of `N1 x ... x Nm` different `k` class Multinomial this as a batch of `N1 x ... x Nm` different `k` class Multinomial
distributions. `p`'s components in the last portion of its shape should distributions. `probs`'s components in the last portion of its shape
sum up to 1. Only one of `logits` or `p` should be passed in. should sum to `1`. Only one of `logits` or `probs` should be passed in.
* <b>`validate_args`</b>: `Boolean`, default `False`. Whether to assert valid * <b>`validate_args`</b>: Python `Boolean`, default `False`. When `True` distribution
values for parameters `n` and `p`, and `x` in `prob` and `log_prob`. parameters are checked for validity despite possibly degrading runtime
If `False`, correct behavior is not guaranteed. performance. When `False` invalid inputs may silently render incorrect
* <b>`allow_nan_stats`</b>: `Boolean`, default `True`. If `False`, raise an outputs.
exception if a statistic (e.g. mean/mode/etc...) is undefined for any * <b>`allow_nan_stats`</b>: Python `Boolean`, default `True`. When `True`, statistics
batch member. If `True`, batch members with valid parameters leading to (e.g., mean, mode, variance) use the value "`NaN`" to indicate the
undefined statistics will return NaN for this statistic. result is undefined. When `False`, an exception is raised if one or
* <b>`name`</b>: The name to prefix Ops created by this distribution class. more of the statistic's batch members are undefined.
* <b>`name`</b>: `String` name prefixed to Ops created by this class.
* <b>`Examples`</b>:
```python
# Define 1-batch of 2-class multinomial distribution,
# also known as a Binomial distribution.
dist = Multinomial(n=2., p=[.1, .9])
# Define a 2-batch of 3-class distributions.
dist = Multinomial(n=[4., 5], p=[[.1, .3, .6], [.4, .05, .55]])
```
- - - - - -
@ -377,17 +380,18 @@ Log probability density/mass function (depending on `is_continuous`).
Additional documentation from `Multinomial`: Additional documentation from `Multinomial`:
For each batch of counts `[n_1,...,n_k]`, `P[counts]` is the probability For each batch of counts, `value = [n_0, ...
that after sampling `n` draws from this Multinomial distribution, the ,n_{k-1}]`, `P[value]` is the probability that after sampling `self.total_count`
number of draws falling in class `j` is `n_j`. Note that different draws from this Multinomial distribution, the number of draws falling in class
sequences of draws can result in the same counts, thus the probability `j` is `n_j`. Since this definition is [exchangeable](
includes a combinatorial coefficient. https://en.wikipedia.org/wiki/Exchangeable_random_variables); different
sequences have the same counts so the probability includes a combinatorial
coefficient.
Note that input "counts" must be a non-negative tensor with dtype `dtype` Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no
and whose shape can be broadcast with `self.p` and `self.n`. For fixed fractional components, and such that
leading dimensions, the last dimension represents counts for the `tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable
corresponding Multinomial distribution in `self.p`. `counts` is only legal with `self.probs` and `self.total_count`.
if it sums up to `n` and its components are equal to integer values.
##### Args: ##### Args:
@ -452,13 +456,6 @@ Mean.
Mode. Mode.
- - -
#### `tf.contrib.distributions.Multinomial.n` {#Multinomial.n}
Number of trials.
- - - - - -
#### `tf.contrib.distributions.Multinomial.name` {#Multinomial.name} #### `tf.contrib.distributions.Multinomial.name` {#Multinomial.name}
@ -466,15 +463,6 @@ Number of trials.
Name prepended to all ops created by this `Distribution`. Name prepended to all ops created by this `Distribution`.
- - -
#### `tf.contrib.distributions.Multinomial.p` {#Multinomial.p}
Vector of probabilities summing to one.
Each element is the probability of drawing that coordinate.
- - - - - -
#### `tf.contrib.distributions.Multinomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Multinomial.param_shapes} #### `tf.contrib.distributions.Multinomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Multinomial.param_shapes}
@ -593,17 +581,18 @@ Probability density/mass function (depending on `is_continuous`).
Additional documentation from `Multinomial`: Additional documentation from `Multinomial`:
For each batch of counts `[n_1,...,n_k]`, `P[counts]` is the probability For each batch of counts, `value = [n_0, ...
that after sampling `n` draws from this Multinomial distribution, the ,n_{k-1}]`, `P[value]` is the probability that after sampling `self.total_count`
number of draws falling in class `j` is `n_j`. Note that different draws from this Multinomial distribution, the number of draws falling in class
sequences of draws can result in the same counts, thus the probability `j` is `n_j`. Since this definition is [exchangeable](
includes a combinatorial coefficient. https://en.wikipedia.org/wiki/Exchangeable_random_variables); different
sequences have the same counts so the probability includes a combinatorial
coefficient.
Note that input "counts" must be a non-negative tensor with dtype `dtype` Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no
and whose shape can be broadcast with `self.p` and `self.n`. For fixed fractional components, and such that
leading dimensions, the last dimension represents counts for the `tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable
corresponding Multinomial distribution in `self.p`. `counts` is only legal with `self.probs` and `self.total_count`.
if it sums up to `n` and its components are equal to integer values.
##### Args: ##### Args:
@ -618,6 +607,15 @@ if it sums up to `n` and its components are equal to integer values.
values of type `self.dtype`. values of type `self.dtype`.
- - -
#### `tf.contrib.distributions.Multinomial.probs` {#Multinomial.probs}
Vector of probabilities summing to one.
Each element is the probability of drawing that coordinate.
- - - - - -
#### `tf.contrib.distributions.Multinomial.reparameterization_type` {#Multinomial.reparameterization_type} #### `tf.contrib.distributions.Multinomial.reparameterization_type` {#Multinomial.reparameterization_type}
@ -688,6 +686,13 @@ survival_function(x) = P[X > x]
`self.dtype`. `self.dtype`.
- - -
#### `tf.contrib.distributions.Multinomial.total_count` {#Multinomial.total_count}
Number of trials used to construct a sample.
- - - - - -
#### `tf.contrib.distributions.Multinomial.validate_args` {#Multinomial.validate_args} #### `tf.contrib.distributions.Multinomial.validate_args` {#Multinomial.validate_args}

View File

@ -1,14 +1,14 @@
Bernoulli with `p = sigmoid(p)`. Bernoulli with `probs = nn.sigmoid(logits)`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.__init__(p=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='BernoulliWithSigmoidP')` {#BernoulliWithSigmoidP.__init__} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.__init__(logits=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='BernoulliWithSigmoidProbs')` {#BernoulliWithSigmoidProbs.__init__}
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.allow_nan_stats` {#BernoulliWithSigmoidP.allow_nan_stats} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.allow_nan_stats` {#BernoulliWithSigmoidProbs.allow_nan_stats}
Python boolean describing behavior when a stat is undefined. Python boolean describing behavior when a stat is undefined.
@ -29,7 +29,7 @@ undefined.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.batch_shape(name='batch_shape')` {#BernoulliWithSigmoidP.batch_shape} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.batch_shape(name='batch_shape')` {#BernoulliWithSigmoidProbs.batch_shape}
Shape of a single sample from a single event index as a 1-D `Tensor`. Shape of a single sample from a single event index as a 1-D `Tensor`.
@ -49,7 +49,7 @@ independent distributions of this kind the instance represents.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.cdf(value, name='cdf')` {#BernoulliWithSigmoidP.cdf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.cdf(value, name='cdf')` {#BernoulliWithSigmoidProbs.cdf}
Cumulative distribution function. Cumulative distribution function.
@ -74,7 +74,7 @@ cdf(x) := P[X <= x]
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.copy(**override_parameters_kwargs)` {#BernoulliWithSigmoidP.copy} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.copy(**override_parameters_kwargs)` {#BernoulliWithSigmoidProbs.copy}
Creates a deep copy of the distribution. Creates a deep copy of the distribution.
@ -97,21 +97,21 @@ intialization arguments.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.dtype` {#BernoulliWithSigmoidP.dtype} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.dtype` {#BernoulliWithSigmoidProbs.dtype}
The `DType` of `Tensor`s handled by this `Distribution`. The `DType` of `Tensor`s handled by this `Distribution`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.entropy(name='entropy')` {#BernoulliWithSigmoidP.entropy} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.entropy(name='entropy')` {#BernoulliWithSigmoidProbs.entropy}
Shannon entropy in nats. Shannon entropy in nats.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.event_shape(name='event_shape')` {#BernoulliWithSigmoidP.event_shape} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.event_shape(name='event_shape')` {#BernoulliWithSigmoidProbs.event_shape}
Shape of a single sample from a single batch as a 1-D int32 `Tensor`. Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
@ -128,7 +128,7 @@ Shape of a single sample from a single batch as a 1-D int32 `Tensor`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.get_batch_shape()` {#BernoulliWithSigmoidP.get_batch_shape} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.get_batch_shape()` {#BernoulliWithSigmoidProbs.get_batch_shape}
Shape of a single sample from a single event index as a `TensorShape`. Shape of a single sample from a single event index as a `TensorShape`.
@ -142,7 +142,7 @@ Same meaning as `batch_shape`. May be only partially defined.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.get_event_shape()` {#BernoulliWithSigmoidP.get_event_shape} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.get_event_shape()` {#BernoulliWithSigmoidProbs.get_event_shape}
Shape of a single sample from a single batch as a `TensorShape`. Shape of a single sample from a single batch as a `TensorShape`.
@ -156,14 +156,14 @@ Same meaning as `event_shape`. May be only partially defined.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.is_continuous` {#BernoulliWithSigmoidP.is_continuous} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_continuous` {#BernoulliWithSigmoidProbs.is_continuous}
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.is_scalar_batch(name='is_scalar_batch')` {#BernoulliWithSigmoidP.is_scalar_batch} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_scalar_batch(name='is_scalar_batch')` {#BernoulliWithSigmoidProbs.is_scalar_batch}
Indicates that `batch_shape == []`. Indicates that `batch_shape == []`.
@ -180,7 +180,7 @@ Indicates that `batch_shape == []`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.is_scalar_event(name='is_scalar_event')` {#BernoulliWithSigmoidP.is_scalar_event} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_scalar_event(name='is_scalar_event')` {#BernoulliWithSigmoidProbs.is_scalar_event}
Indicates that `event_shape == []`. Indicates that `event_shape == []`.
@ -197,7 +197,7 @@ Indicates that `event_shape == []`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_cdf(value, name='log_cdf')` {#BernoulliWithSigmoidP.log_cdf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_cdf(value, name='log_cdf')` {#BernoulliWithSigmoidProbs.log_cdf}
Log cumulative distribution function. Log cumulative distribution function.
@ -226,7 +226,7 @@ a more accurate answer than simply taking the logarithm of the `cdf` when
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_pdf(value, name='log_pdf')` {#BernoulliWithSigmoidP.log_pdf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_pdf(value, name='log_pdf')` {#BernoulliWithSigmoidProbs.log_pdf}
Log probability density function. Log probability density function.
@ -250,7 +250,7 @@ Log probability density function.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_pmf(value, name='log_pmf')` {#BernoulliWithSigmoidP.log_pmf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_pmf(value, name='log_pmf')` {#BernoulliWithSigmoidProbs.log_pmf}
Log probability mass function. Log probability mass function.
@ -274,7 +274,7 @@ Log probability mass function.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_prob(value, name='log_prob')` {#BernoulliWithSigmoidP.log_prob} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_prob(value, name='log_prob')` {#BernoulliWithSigmoidProbs.log_prob}
Log probability density/mass function (depending on `is_continuous`). Log probability density/mass function (depending on `is_continuous`).
@ -293,7 +293,7 @@ Log probability density/mass function (depending on `is_continuous`).
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.log_survival_function(value, name='log_survival_function')` {#BernoulliWithSigmoidP.log_survival_function} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_survival_function(value, name='log_survival_function')` {#BernoulliWithSigmoidProbs.log_survival_function}
Log survival function. Log survival function.
@ -322,46 +322,39 @@ survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.logits` {#BernoulliWithSigmoidP.logits} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.logits` {#BernoulliWithSigmoidProbs.logits}
Log-odds of success. Log-odds of a `1` outcome (vs `0`).
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.mean(name='mean')` {#BernoulliWithSigmoidP.mean} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.mean(name='mean')` {#BernoulliWithSigmoidProbs.mean}
Mean. Mean.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.mode(name='mode')` {#BernoulliWithSigmoidP.mode} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.mode(name='mode')` {#BernoulliWithSigmoidProbs.mode}
Mode. Mode.
Additional documentation from `Bernoulli`: Additional documentation from `Bernoulli`:
Returns `1` if `p > 1-p` and `0` otherwise. Returns `1` if `prob > 0.5` and `0` otherwise.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.name` {#BernoulliWithSigmoidP.name} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.name` {#BernoulliWithSigmoidProbs.name}
Name prepended to all ops created by this `Distribution`. Name prepended to all ops created by this `Distribution`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.p` {#BernoulliWithSigmoidP.p} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#BernoulliWithSigmoidProbs.param_shapes}
Probability of success.
- - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#BernoulliWithSigmoidP.param_shapes}
Shapes of parameters given the desired shape of a call to `sample()`. Shapes of parameters given the desired shape of a call to `sample()`.
@ -385,7 +378,7 @@ Subclasses should override class method `_param_shapes`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.param_static_shapes(cls, sample_shape)` {#BernoulliWithSigmoidP.param_static_shapes} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.param_static_shapes(cls, sample_shape)` {#BernoulliWithSigmoidProbs.param_static_shapes}
param_shapes with static (i.e. `TensorShape`) shapes. param_shapes with static (i.e. `TensorShape`) shapes.
@ -415,14 +408,14 @@ constant-valued tensors when constant values are fed.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.parameters` {#BernoulliWithSigmoidP.parameters} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.parameters` {#BernoulliWithSigmoidProbs.parameters}
Dictionary of parameters used to instantiate this `Distribution`. Dictionary of parameters used to instantiate this `Distribution`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.pdf(value, name='pdf')` {#BernoulliWithSigmoidP.pdf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.pdf(value, name='pdf')` {#BernoulliWithSigmoidProbs.pdf}
Probability density function. Probability density function.
@ -446,7 +439,7 @@ Probability density function.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.pmf(value, name='pmf')` {#BernoulliWithSigmoidP.pmf} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.pmf(value, name='pmf')` {#BernoulliWithSigmoidProbs.pmf}
Probability mass function. Probability mass function.
@ -470,7 +463,7 @@ Probability mass function.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.prob(value, name='prob')` {#BernoulliWithSigmoidP.prob} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.prob(value, name='prob')` {#BernoulliWithSigmoidProbs.prob}
Probability density/mass function (depending on `is_continuous`). Probability density/mass function (depending on `is_continuous`).
@ -489,14 +482,14 @@ Probability density/mass function (depending on `is_continuous`).
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.q` {#BernoulliWithSigmoidP.q} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.probs` {#BernoulliWithSigmoidProbs.probs}
1-p. Probability of a `1` outcome (vs `0`).
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.reparameterization_type` {#BernoulliWithSigmoidP.reparameterization_type} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.reparameterization_type` {#BernoulliWithSigmoidProbs.reparameterization_type}
Describes how samples from the distribution are reparameterized. Describes how samples from the distribution are reparameterized.
@ -511,7 +504,7 @@ or `distributions.NOT_REPARAMETERIZED`.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.sample(sample_shape=(), seed=None, name='sample')` {#BernoulliWithSigmoidP.sample} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.sample(sample_shape=(), seed=None, name='sample')` {#BernoulliWithSigmoidProbs.sample}
Generate samples of the specified shape. Generate samples of the specified shape.
@ -533,14 +526,14 @@ sample.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.stddev(name='stddev')` {#BernoulliWithSigmoidP.stddev} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.stddev(name='stddev')` {#BernoulliWithSigmoidProbs.stddev}
Standard deviation. Standard deviation.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.survival_function(value, name='survival_function')` {#BernoulliWithSigmoidP.survival_function} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.survival_function(value, name='survival_function')` {#BernoulliWithSigmoidProbs.survival_function}
Survival function. Survival function.
@ -566,14 +559,14 @@ survival_function(x) = P[X > x]
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.validate_args` {#BernoulliWithSigmoidP.validate_args} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.validate_args` {#BernoulliWithSigmoidProbs.validate_args}
Python boolean indicated possibly expensive checks are enabled. Python boolean indicated possibly expensive checks are enabled.
- - - - - -
#### `tf.contrib.distributions.BernoulliWithSigmoidP.variance(name='variance')` {#BernoulliWithSigmoidP.variance} #### `tf.contrib.distributions.BernoulliWithSigmoidProbs.variance(name='variance')` {#BernoulliWithSigmoidProbs.variance}
Variance. Variance.

View File

@ -738,7 +738,7 @@
* **[Statistical Distributions (contrib)](../../api_docs/python/contrib.distributions.md)**: * **[Statistical Distributions (contrib)](../../api_docs/python/contrib.distributions.md)**:
* [`Bernoulli`](../../api_docs/python/contrib.distributions.md#Bernoulli) * [`Bernoulli`](../../api_docs/python/contrib.distributions.md#Bernoulli)
* [`BernoulliWithSigmoidP`](../../api_docs/python/contrib.distributions.md#BernoulliWithSigmoidP) * [`BernoulliWithSigmoidProbs`](../../api_docs/python/contrib.distributions.md#BernoulliWithSigmoidProbs)
* [`Beta`](../../api_docs/python/contrib.distributions.md#Beta) * [`Beta`](../../api_docs/python/contrib.distributions.md#Beta)
* [`BetaWithSoftplusAB`](../../api_docs/python/contrib.distributions.md#BetaWithSoftplusAB) * [`BetaWithSoftplusAB`](../../api_docs/python/contrib.distributions.md#BetaWithSoftplusAB)
* [`Binomial`](../../api_docs/python/contrib.distributions.md#Binomial) * [`Binomial`](../../api_docs/python/contrib.distributions.md#Binomial)