tensorflow / probability

Probabilistic reasoning and statistical analysis in TensorFlow

Home Page:https://www.tensorflow.org/probability/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Potentially misleading method names?

lcs-crr opened this issue · comments

I've been dealing with the documentation for the the tfp.distributions.Normal and found that tfp.distributions.Normal.prob, tfp.distributions.Normal.log_prob and tfp.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?

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.