The FiniteDiscrete distribution is parameterized by either probabilities or
log-probabilities of a set of K
possible outcomes, which is defined by
a strictly ascending list of K
values.
tfd_finite_discrete(
outcomes,
logits = NULL,
probs = NULL,
rtol = NULL,
atol = NULL,
validate_args = FALSE,
allow_nan_stats = TRUE,
name = "FiniteDiscrete"
)
a distribution instance.
A 1-D floating or integer Tensor
, representing a list of
possible outcomes in strictly ascending order.
A floating N-D Tensor
, N >= 1
, representing the log
probabilities of a set of FiniteDiscrete distributions. The first N - 1
dimensions index into a batch of independent distributions and the
last dimension represents a vector of logits for each discrete value.
Only one of logits
or probs
should be passed in.
A floating N-D Tensor
, N >= 1
, representing the probabilities
of a set of FiniteDiscrete distributions. The first N - 1
dimensions
index into a batch of independent distributions and the last dimension
represents a vector of probabilities for each discrete value. Only one
of logits
or probs
should be passed in.
Tensor
with same dtype
as outcomes
. The relative tolerance for
floating number comparison. Only effective when outcomes
is a floating
Tensor
. Default is 10 * eps
.
Tensor
with same dtype
as outcomes
. The absolute tolerance for
floating number comparison. Only effective when outcomes
is a floating
Tensor
. Default is 10 * eps
.
Logical, default FALSE. When TRUE distribution parameters are checked for validity despite possibly degrading runtime performance. When FALSE invalid inputs may silently render incorrect outputs. Default value: FALSE.
Logical, 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.
string prefixed to Ops created by this class.
Note: log_prob, prob, cdf, mode, and entropy are differentiable with respect
to logits
or probs
but not with respect to outcomes
.
Mathematical Details
The probability mass function (pmf) is,
pmf(x; pi, qi) = prod_j pi_j**[x == qi_j]
For usage examples see e.g. tfd_sample()
, tfd_log_prob()
, tfd_mean()
.