You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that this object does not contain a log-likelihood, which seems weird. The missing log-likehood is problematic as I can use other functionalities such as .loo
I'm able to calculate the log-likelihood by hand, like
alpha_hat = samples_logistic["alpha"].mean(axis=0).detach().numpy()
beta_hat = samples_logistic["beta"].mean(axis=0).detach().numpy()
y_hat = sigmoid(alpha_hat + np.dot(X_test, beta_hat))
log_likelihood_logit = stats.binom.logpmf(1, n = 1, p =y_hat)
By arviz.frompyro does not accept manually specified log-likelihood as argument (arviz.frompystan accept this argument).
I'm using arviz version '0.7.0' and pyro version '1.2.1'
The text was updated successfully, but these errors were encountered:
az.from_pyro uses pyro.Predictive.get_vectorized_trace() to automatically retrieve and store pointwise log likelihood samples. To get the log_likelihood group populated, ArviZ must be able to execute this function, which as stated in Pyro docs:
... requires that the model has all batch dims correctly annotated via plate.
In your case, I think you need to annotate the dimension of betaX.shape[1] with plate to allow ArviZ to automatically populate log_likelihood group.
If this were not to work (I am not a Pyro expert), you can always combine from_pyro with from_dict and do something like:
I'm trying to get log-likelihood estimates via arviz from my logistic regression model
My model looks like this:
I train it via standard MCMC, like this:
And then I would like to convert it to an arviz module.
The problem is that this object does not contain a log-likelihood, which seems weird. The missing log-likehood is problematic as I can use other functionalities such as .loo
I'm able to calculate the log-likelihood by hand, like
By arviz.frompyro does not accept manually specified log-likelihood as argument (arviz.frompystan accept this argument).
I'm using arviz version '0.7.0' and pyro version '1.2.1'
The text was updated successfully, but these errors were encountered: