Skip to main content

importance_sampling_estimate

Function importance_sampling_estimate 

Source
pub fn importance_sampling_estimate(
    samples: &[f64],
    h: impl Fn(f64) -> f64,
    target: impl Fn(f64) -> f64,
    proposal: impl Fn(f64) -> f64,
) -> (f64, f64)
Expand description

Compute IS estimate of E\[h(X)\] where X ~ target but samples are drawn from proposal.

Returns (estimate, effective_sample_size).

weights\[i\] = target(x_i) / proposal(x_i).