I'm reading Probabilistic Programming and Bayesian Methods for Hackers. In Ch5, it is written that logp = pm.Normal.dist(mu=price_estimate, sd=(3e3)).logp(true_price)
.
What is this? I know pm.Normal()
but don't know .dist()
and .logp()
.
pm.Normal
creates a new random variable and adds that to the model. pm.Normal.dist
represents the distribution itself, it does not interact with the model at all. pm.Normal.dist(...).logp(value)
is the log of the probability density function (or probability mass function if the distribution is discrete) at the point value
.