Skip to content

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

@ztangent

Description

@ztangent

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions