You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: md/Gibbs-Ask.md
+14-14
Original file line number
Diff line number
Diff line change
@@ -17,19 +17,19 @@ __function__ GIBBS-ASK(_X_, __e__, _bn_, _N_) __returns__ an estimate of __P__(_
17
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
18
19
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
-
   __choose__ any variable _Z<sub>i</sub>_ from __Z__ acoording to any distribution _ρ(i)_
30
-
     set the value of _Z<sub>i</sub>_ in __x__ by sampling from __P__(_Z<sub>i</sub>_ |_mb_(_Z<sub>i</sub>_))
31
-
     __N__\[_x_\]←__N__\[_x_\]+ 1 where _x_ is the value of _X_ in __x__
32
-
 __return__ NORMALIZE(__N__)
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
+
   __choose__ any variable _Z<sub>i</sub>_ from __Z__ acoording to any distribution _ρ(i)_
30
+
     set the value of _Z<sub>i</sub>_ in __x__ by sampling from __P__(_Z<sub>i</sub>_ |_mb_(_Z<sub>i</sub>_))
31
+
     __N__\[_x_\]←__N__\[_x_\]+ 1 where _x_ is the value of _X_ in __x__
32
+
 __return__ NORMALIZE(__N__)
33
33
34
34
---
35
-
__Figure__ ?? The Gibbs sampling algorithm for approximate inference in Bayesian networks; this version cycles through the variables, but choosing variables at random also works.
35
+
__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