A log probability is the natural logarithm of a probability value. Probability distributions commonly expose log probabilities because they offer computational advantages over ordinary probabilities. Applying the exponential function converts a log probability back to the probability scale. section 2.1.7
Bernoulli probability in Pyro
For a Bernoulli distribution with probability 0.4, log_prob evaluates the outcome 1.0 on the logarithmic scale. Applying math.exp to that result returns approximately 0.4; the small discrepancy comes from floating-point rounding. section 2.1.7
lprob = bern.log_prob(torch.tensor(1.0)) import math print(math.exp(lprob))
The executable example shows how to obtain a Bernoulli log probability and convert it back to probability with math.exp. section 2.1.7







