Closed elanmart closed 3 years ago
Thanks for finding this! I just pushed a simple fix, should work now. How's Statistical Rethinking coming along?
Thanks for the quick fix! Slower than I expected :( Maybe I'll be able to focus more on it soon, I've just started Chapter 5, need to push Chapter 4 code.
I love the simplicity of mcx
syntax so far!
Here's another issue I found with logpdf
, should I open another ticket :grinning: ?
import mcx
from mcx import distributions as dist
@mcx.model
def model(x, xbar):
beta <~ dist.Normal(0, 1)
mu = beta * (x - xbar)
yhat <~ dist.Normal(mu, 1)
return yhat
print(model.logpdf_src)
def model_logpdf(x, xbar, beta, yhat):
logpdf_model_beta = dist.Normal(0, 1).logpdf_sum(beta)
mu = beta * x - xbar
logpdf_model_yhat = dist.Normal(mu, 1).logpdf_sum(yhat)
logpdf = logpdf_model_beta + logpdf_model_yhat
return logpdf
So beta * (x - xbar)
changes to beta * x - xbar
because parenthesis are discarded. But I think I saw a warning about this somewhere in the docs...?
There is a warning in the docs but that constraint is actually not justified anymore. I'll see what I can do!
This was, again, an easy fix. Thank you for spotting and reporting! By the end of the book MCX should be very robust :)
On
mcx
master branch:produces
Note that
logpdf_model_a
is missing in the summation.