Open n-kall opened 1 year ago
This could push https://github.com/arviz-devs/arviz/pull/2086 over the line, and unblock both this feature and https://github.com/arviz-devs/arviz/pull/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.
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.
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:
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)