Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nutpie doesn't compute element-wise log-likelihood #150

Open
AlexAndorra opened this issue Oct 8, 2024 · 0 comments
Open

Nutpie doesn't compute element-wise log-likelihood #150

AlexAndorra opened this issue Oct 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@AlexAndorra
Copy link
Contributor

The elemwise log-likelihood is not stored in the InferenceData that nutpie returns, even when asking for it. The following for instance doesn't error out, but doesn't add a log_likelihood group to the trace (whereas it does when using the default PyMC sampler):

y = np.array([28, 8, -3, 7, -1, 1, 18, 12])
sigma = np.array([15, 10, 16, 11, 9, 11, 10, 18])
J = len(y)

with pm.Model() as pooled:
    mu = pm.Normal("mu", 0, sigma=10)
    obs = pm.Normal("obs", mu, sigma=sigma, observed=y)

    trace_p = pm.sample(nuts_sampler="nutpie", idata_kwargs={"log_likelihood": True}) # doesn't store
    trace_p_ = pm.sample(idata_kwargs={"log_likelihood": True}) # does store

In PyMC it's not that big of a deal (although it adds friction to the user workflow), as one can just do:

with pooled:
    pm.compute_log_likelihood(trace_p)

But that may be a small issue for Bambi users, which are usually less advanced (cc @tomicapretto). They'd have to do pooled.compute_log_likelihood(trace_p), which takes much more time to compute

@AlexAndorra AlexAndorra added the bug Something isn't working label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant