Skip to content

Method of approximation for variable elimination implemented in python

Notifications You must be signed in to change notification settings

sebastian9991/Gibbs-Sampling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Gibbs-Sampling

Method of approximation for variable elimination implemented in python

$$ \begin{align} P(A | B = b^{1}) &= \frac{1}{Z}\sum_{DC}(\Phi_1(A,B) \Phi_2(B,C) \Phi_3(C, D) \Phi_4(D,A))_{B = b^1} (Obs\,B = b^{1})\\ &= \frac{1}{Z}\sum_{DC}((\Phi_1(A) \Phi_2(C) \Phi_3(C, D) \Phi_4(D,A))_{B = b^1}(Elimination\, Order\, = C,D)\\ &= \frac{1}{Z}(\Phi_1(A) \sum_{D} \Phi_4(D,A)\sum_{C}\Phi_3(C,D) \Phi_2(C))(Sum\, out\, C)\\ &= \frac{1}{Z}(\Phi_1(A) \sum_{D} \Phi_4(D,A)\Phi_5(D))(Sum\,out\, D)\\ &= \frac{1}{Z}(\Phi_1(A) \Phi_6(A))\\ &\approx \end{align} $$

image

We show the process of the resulting factor tables:

image

image

Gibbs sampling procedure:

Randomly choosing A,C or D then sampling based on the posterior distribution of their Markov blanket. The convergence of the sampling procedure is shown in the figure below. The red line represents the value gained from variable elimination for $P(A = a1|B = b1)$

Figure_1

Releases

No releases published

Packages

No packages published

Languages