View source: R/distributions.R
tfd_finite_discrete | R Documentation |
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" )
outcomes |
A 1-D floating or integer |
logits |
A floating N-D |
probs |
A floating N-D |
rtol |
|
atol |
|
validate_args |
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. |
allow_nan_stats |
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. |
name |
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]
a distribution instance.
For usage examples see e.g. tfd_sample()
, tfd_log_prob()
, tfd_mean()
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.