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

Add Pareto Smoothed Importance Sampling (PSIS) diagnostic method #1804

Open
asmuzsoy opened this issue May 21, 2024 · 4 comments
Open

Add Pareto Smoothed Importance Sampling (PSIS) diagnostic method #1804

asmuzsoy opened this issue May 21, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@asmuzsoy
Copy link

The Pareto Smoothed Importance Sampling $\hat{k}$ diagnostic (as described by Yao et al. (2018)) can be used to determine if a surrogate posterior determined with variational inference is a good approximation of the true posterior. It would be great if there was a built-in method to calculate $\hat{k}$ in NumPyro (as there is in Pyro).

I have created a preliminary implementation for my work (seen here) that calculates the log importance ratios and uses the arviz.stats.stats._psislw() method to calculate $\hat{k}$. It can be easily generalized for use with any model and guide.

Any thoughts would be much appreciated!

@fehiepsi fehiepsi added the enhancement New feature or request label Jun 22, 2024
@tillahoffmann
Copy link
Contributor

That's very cool! I didn't know there was a nice diagnostic for how "good" variational approximations are. Just wondering if this could be a nice contribution to arviz itself so the method can also be used for other inference frameworks, e.g., Stan?

@asmuzsoy
Copy link
Author

There is a method in arviz (arviz.stats.stats._psislw()) which calculates the test statistic given the log importance ratios. But to calculate the log importance ratios you need the numpyro model, guide, best fit parameters, and the samples that you're trying to evaluate, thus my suggestion for a new method that would do this all in one go.

@tillahoffmann
Copy link
Contributor

Do you know if it's possible to evaluate those other quantities from the arviz InferenceData object?

@asmuzsoy
Copy link
Author

I don't think so, unless arviz.InferenceData somehow incorporates a numpyro model and guide?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants