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

[Feature] Implement importance weighted moment matching #2136

Open
n-kall opened this issue Oct 12, 2022 · 2 comments
Open

[Feature] Implement importance weighted moment matching #2136

n-kall opened this issue Oct 12, 2022 · 2 comments

Comments

@n-kall
Copy link
Contributor

n-kall commented Oct 12, 2022

Description

Importance weighted moment matching (IWMM) is an implicitly adaptive importance sampling method that improves proposal distributions in importance sampling by performing affine transformations on the proposal draws. This can be used in e.g. loo-cv or power-scaling sensitivity analysis, when Pareto-smoothed importance sampling is not stable.

The paper describing the method is available here: https://link.springer.com/article/10.1007/s11222-020-09982-2 and a reference method is implemented in R: https://github.com/topipa/iwmm
The loo R package (https://github.com/stan-dev/loo) also has an implementation.

Thoughts on implementation

In order to run IWMM, I think the following are required:

  • unconstrained parameter draws
  • method to compute the posterior density for specified parameter values
  • method to transform unconstrained draws to constrained draws

I'm happy to help with this, as I have been working with the R code and translating it should not be too hard, however I'm unsure of the best approach to get access to the above requirements (as they aren't usually in an InferenceData object)

@ColCarroll
Copy link
Member

This could push #2086 over the line, and unblock both this feature and #2040

Does this feature actually need two functions for computing posterior density and a constraining bijector, or does it suffice to be able to match unconstrained draws to the constrained draws, and map the constrained draws to the density? I guess I'm wondering if you need to compute density for novel points, and to constrain novel points.

My own opinion is that if you need these functions in addition to the InferenceData, it might be better as a standalone library (possibly under arviz-devs if you don't want to maintain it!) or living with an inference library, but I'm not hard to convince.

@n-kall
Copy link
Contributor Author

n-kall commented Oct 13, 2022

In most cases, the posterior is acting as a proposal distribution for the importance sampling. The IWMM algorithm adapts the posterior draws (working in unconstrained space). It transforms these draws and calculates the density ratio for these new draws to arrive at a better proposal (this may involve calculating the log posterior density of the newly transformed draws). Once the algorithm finishes, we would want to constrain the transformed draws before calculating expectations with the importance weights.

So, I think, yes we would need to be able to calculate the posterior density for new (unconstrained) points, and also constrain these new points.

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

No branches or pull requests

2 participants