Interactive element. Adjust the sample distribution, the desired distribution, and the resampling trategy via the dropdown menus, and observe how importance sampling attempts to approximate the desired distribution using the sample distribution. All samples are black, sample weight is represented as opacity. Press the resampling button to generate new equal-weighted samples from the current weighted ensemble.

Importance sampling with resampling

This element is an extension of this element. Select a sampling distribution and a desired distribution, and watch how importance sampling approximates the desired distribution by assigning weights to each sample. Then select a resampling strategy and press the "resample" button. How do the different resampling strategies affect the effective sample size and the number of unique samples?