Electron microscopy
 
PythonML
Likelihood Weighting
- Python Automation and Machine Learning for ICs -
- An Online Book -
Python Automation and Machine Learning for ICs                                                           http://www.globalsino.com/ICs/        


Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

=================================================================================

Likelihood weighting is a technique used in probabilistic graphical models and Bayesian networks for estimating probabilities. It is particularly useful in the Bayesian networks when dealing with evidence or observations. In Bayesian networks, nodes represent random variables, and edges represent probabilistic dependencies between them. Given evidence or observations in some nodes, likelihood weighting is used to estimate the probability of certain events or states in the network. 

The basic steps of likelihood weighting are: 

  1. Initialize: 

    Set the weight of the sample to 1. 

  2. Sample: 

    Sample values for all the variables in the network.

    Fix Evidence Variables: For each observed or evidence variable, fix its value to the observed value.  Namely, if a variable is evidence (observed), fix its value to the observed value.

    Sample Non-Evidence Variables: Sample values for the remaining non-evidence variables using conditional probabilities. Each variable is sampled based on the probability distribution given its parents in the Bayesian network. 

  3. Weighting: 

    Multiply the weight of the sample by the likelihood of the observed evidence. This involves multiplying the conditional probability of each variable given its parents in the network. 

  4. Repeat: 

    Repeat steps 2 and 3 for a sufficient number of samples. 

  5. Normalization: 

    Normalize the weights to ensure that they sum to 1, making them proper probability weights. 

  6. Estimate: 

    Use the weighted samples to estimate probabilities or make predictions about unobserved variables in the Bayesian network. 

Likelihood weighting is particularly useful when there's evidence present in the network, as it avoids sampling from unlikely portions of the state space by assigning weights to samples based on the likelihood of the evidence. This makes it more efficient than simple random sampling when dealing with Bayesian networks. The use of weights in likelihood weighting helps correct for the fact that the samples are not uniformly distributed in the state space but are biased towards regions consistent with the observed evidence.

Let's consider a simplified Bayesian network involving two variables: "Rain" and "See doctor," where "See doctor" is dependent on "Rain." The conditional probability table might look like this:

       P(Rain) 

       --------- 

       Rain = light: 0.3 

       Rain = heavy: 0.7 

       P(See doctor | Rain) 

       --------------------- 

       Rain = light: 0.1 (on time), 0.9 (late) 

       Rain = heavy: 0.9 (on time), 0.1 (late)  

Suppose we observe that the person sees the doctor on time (i.e., "See doctor = on time"). We want to estimate the probability of light rain ("Rain = light") given this evidence using likelihood weighting. 

  1. Initialization: 

    Start with a weight of 1. 

  2. Fix Evidence Variable: 

    Set "See doctor" to "on time." 

  3. Sample Non-Evidence Variable ("Rain"): 

    Sample the value for "Rain" based on its conditional probabilities given the fixed evidence. Let's say we sample "Rain = light" with a probability of 0.3. 

  4. Weighting: 

    Multiply the weight by the likelihood of the observed evidence. In this case, multiply the weight by the probability of "See doctor = on time" given "Rain = light," which is 0.1. 

  5. Repeat: 

    Repeat steps 2-4 for a sufficient number of samples. 

  6. Normalization: 

    Normalize the weights. 

  7. Estimation: 

    Use the weighted samples to estimate the probability of "Rain = light" given "See doctor = on time." 

The final estimate would be a weighted average of the samples, where the weights are adjusted based on the likelihood of the observed evidence. This process helps account for the evidence and provides a more accurate estimate of the probability of interest.  In this example script, we have code lines:

       

where, we set,

P(Rain = light) is set to 0.3, indicating that light rain is not very likely. 

P(See doctor = on time | Rain = light) is set to 0.9, suggesting that if it's light rain, there's a 90% chance of seeing the doctor on time. The likelihood weighting process reflects the information encoded in the conditional probabilities specified in the example Bayesian network.

============================================

         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         

 

 

 

 

 



















































 

 

 

 

 

=================================================================================