Fix evidence variables and sample the rest, and use weights by probability of evidence given parents
turn the evidence collected to the value we querying
each sample have its own weight
Instead of taking in the evidence variables, add a weight to guess the likelyhood of those variables to be in the way we want it to be with P(xi∣parent(Xi))
for each sample:
Input: evidences instantiation
w = 1 at first
For i= 1,2,…n:
if Xi is an evidence variable
Xi = observation xi for Xi
w = w * P(xi∣parent(Xi))
else: sample xi from P(Xi∣parent(Xi))
return (x1,x2,...,xn), w
Likelihood weighting doesn’t solve all our problems
Evidence only influences the choice of downstream variables, but not upstream ones (root variable isn’t more likely to get a value matching the evidence)
We would like to consider evidence when we sample every variable (leads to Gibbs sampling)
Gibbs Sampling:
Procedure:keeptrackofafullinstantiationx1,x2,…,xn. Startwithan arbitrary instantiation consistent with the evidence. Sample one variable at a time, conditioned on all the rest, but keep evidence fixed. Keep repeating this for a long time.
Property: in the limit of repeating this infinitely many times the resulting samples come from the correct distribution (i.e. conditioned on evidence).
Rationale: both upstream and downstream variables condition on evidence.
In contrast: likelihood weighting only conditions on upstream evidence, and hence weights obtained in likelihood weighting can sometimes be very small. Sum of weights over all samples is indicative of how many “effective” samples were obtained, so we want high weight.