GenParticleFilters.jl icon indicating copy to clipboard operation
GenParticleFilters.jl copied to clipboard

Fix computation of unnormalized proper weights after priority-weighted resampling.

Open ztangent opened this issue 9 months ago • 0 comments

When resampling with a priority_fn that outputs log priority scores, the function update_weights! (called after resampling) currently does something that is only correct if we're interested in unbiasedly estimating the normalizing constant / log marginal likelihood estimate, and is not correct for other test functions.

In general, the proper unnormalized weight $\tilde w$ after resampling should* be equal to $w / \overline n$, where $w$ is the original unnormalized weight of a resampled particle, and $\overline n$ is the expected number of times that particle is resampled / copied. When a priority function $\alpha(w)$ is used, we have $\overline n = N \frac{\alpha(w)}{\sum_i \alpha(w^i)}$, so the new weight is $\tilde w = \frac{\sum_i \alpha(w^i)}{N}\frac{w}{\alpha(w)}$.

However, this is not the weight update currently implemented in update_weights!.

In addition to fixing this, the tests will have to be revised to check for genuine proper weighting. This will require Monte Carlo estimation, since the correct weight update creates variance in the LML estimate and other expectations.

*If I did the math right.

ztangent avatar May 04 '25 04:05 ztangent