Closed lcs-crr closed 11 months ago
the names prob and log_prob were chosen exactly for this ambiguity :) for discrete distributions they refer to probabilities, for continuous distributions, they refer to densities.
if you want the probability mass for an interval [a, b]
of a continuous scalar distribution, you can get it from dist.cdf(b) - dist.cdf(a)
if the distribution in question has a cdf
implemented.
Thank you for the reply, does that also mean that for a discrete distribution the log probability is equal to the log likelihood?
I would not state it as such. The definition of "(log) likelihood" is context-dependent, and I'm not sure how you are using it in this context.
For a discrete distribution, log_prob(x) gives the log of the probability mass at x.
I've been dealing with the documentation for the the
tfp.distributions.Normal
and found thattfp.distributions.Normal.prob
,tfp.distributions.Normal.log_prob
andtfp.distributions.Normal.unnormalized_log_prob
actually refers to the probability density, not the actual probability. I would assume that these methods refers to the latter. Also, is there a way to evaluate the probability for a given interval in a distribution?