Skip to content

Commit edf0505

Browse files
committed
4th_ed gibbs ask
1 parent b29b031 commit edf0505

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

md/Gibbs-Ask.md

+18
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,23 @@ __function__ GIBBS-ASK(_X_, __e__, _bn_, _N_) __returns__ an estimate of __P__(_
1313
     __N__\[_x_\] ← __N__\[_x_\] + 1 where _x_ is the value of _X_ in __x__
1414
 __return__ NORMALIZE(__N__)
1515

16+
---
17+
__Figure__ ?? The Gibbs sampling algorithm for approximate inference in Bayesian networks; this version cycles through the variables, but choosing variables at random also works.
18+
19+
---
20+
21+
## AIMA4e
22+
__function__ GIBBS-ASK(_X_, __e__, _bn_, _N_) __returns__ an estimate of __P__(_X_ | __e__)
23+
 __local variables__: __N__, a vector of counts for each value of _X_, initially zero
24+
        __Z__, the nonevidence variables in _bn_
25+
        __x__, the current state of the network, initially copied from __e__
26+
27+
 initialize __x__ with random values for the variables in __Z__
28+
 __for__ _j_ = 1 to _N_ __do__
29+
&emsp;&emsp;&emsp;__choose__ any variable _Z<sub>i</sub>_ from __Z__ acoording to any distribution _&rho;(i)_
30+
&emsp;&emsp;&emsp;&emsp;&emsp;set the value of _Z<sub>i</sub>_ in __x__ by sampling from __P__(_Z<sub>i</sub>_ &vert; _mb_(_Z<sub>i</sub>_))
31+
&emsp;&emsp;&emsp;&emsp;&emsp;__N__\[_x_\] &larr; __N__\[_x_\] &plus; 1 where _x_ is the value of _X_ in __x__
32+
&emsp;__return__ NORMALIZE(__N__)
33+
1634
---
1735
__Figure__ ?? The Gibbs sampling algorithm for approximate inference in Bayesian networks; this version cycles through the variables, but choosing variables at random also works.

0 commit comments

Comments
 (0)