Skip to content

Commit ebceece

Browse files
committed
Indentation error correction
1 parent 0035e98 commit ebceece

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

md/Gibbs-Ask.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ __function__ GIBBS-ASK(_X_, __e__, _bn_, _N_) __returns__ an estimate of __P__(_
1717
__Figure__ ?? The Gibbs sampling algorithm for approximate inference in Bayesian networks; this version cycles through the variables, but choosing variables at random also works.
1818

1919
---
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__)
20+
21+
## AIMA4e
22+
__function__ GIBBS-ASK(_X_, __e__, _bn_, _N_) __returns__ an estimate of __P__(_X_ &vert; __e__)
23+
&emsp;__local variables__: __N__, a vector of counts for each value of _X_, initially zero
24+
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;__Z__, the nonevidence variables in _bn_
25+
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;__x__, the current state of the network, initially copied from __e__
26+
27+
&emsp;initialize __x__ with random values for the variables in __Z__
28+
&emsp;__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__)
3333

3434
---
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.

md/Policy-Iteration.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ __function__ POLICY-ITERATION(_mdp_) __returns__ a policy
2020
__Figure ??__ The policy iteration algorithm for calculating an optimal policy.
2121

2222
---
23-
24-
## AIMA4e
25-
__function__ POLICY-ITERATION(_mdp_) __returns__ a policy
26-
&emsp;__inputs__: _mdp_, an MDP with states _S_, actions _A_(_s_), transition model _P_(_s&prime;_ &vert; _s_, _a_)
27-
&emsp;__local variables__: _U_, a vector of utilities for states in _S_, initially zero
28-
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;_&pi;_, a policy vector indexed by state, initially random
29-
30-
&emsp;__repeat__
31-
&emsp;&emsp;&emsp;_U_ &larr; POLICY\-EVALUATION(_&pi;_, _U_, _mdp_)
32-
&emsp;&emsp;&emsp;_unchanged?_ &larr; true
33-
&emsp;&emsp;&emsp;__for each__ state _s_ __in__ _S_ __do__
34-
&emsp;&emsp;&emsp;&emsp;&emsp;_a <sup> &#x2a; </sup>_ &larr; argmax<sub>_a_ &isin; _A_(_s_)</sub> Q-VALUE(_mdp_,_s_,_a_,_U_)
35-
&emsp;&emsp;&emsp;&emsp;&emsp;__if__ Q-VALUE(_mdp_,_s_,_a<sup>&#x2a;</sup>_,_U_) &gt; Q-VALUE(_mdp_,_s_,_&pi;_\[_s_\],_U_) __then do__
23+
24+
## AIMA4e
25+
__function__ POLICY-ITERATION(_mdp_) __returns__ a policy
26+
&emsp;__inputs__: _mdp_, an MDP with states _S_, actions _A_(_s_), transition model _P_(_s&prime;_ &vert; _s_, _a_)
27+
&emsp;__local variables__: _U_, a vector of utilities for states in _S_, initially zero
28+
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;_&pi;_, a policy vector indexed by state, initially random
29+
30+
&emsp;__repeat__
31+
&emsp;&emsp;&emsp;_U_ &larr; POLICY\-EVALUATION(_&pi;_, _U_, _mdp_)
32+
&emsp;&emsp;&emsp;_unchanged?_ &larr; true
33+
&emsp;&emsp;&emsp;__for each__ state _s_ __in__ _S_ __do__
34+
&emsp;&emsp;&emsp;&emsp;&emsp;_a <sup> &#x2a; </sup>_ &larr; argmax<sub>_a_ &isin; _A_(_s_)</sub> Q-VALUE(_mdp_,_s_,_a_,_U_)
35+
&emsp;&emsp;&emsp;&emsp;&emsp;__if__ Q-VALUE(_mdp_,_s_,_a<sup>&#x2a;</sup>_,_U_) &gt; Q-VALUE(_mdp_,_s_,_&pi;_\[_s_\],_U_) __then do__
3636
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;_&pi;_\[_s_\] &larr; _a<sup>&#x2a;</sup>_ ; _unchanged?_ &larr; false
37-
&emsp;__until__ _unchanged?_
38-
&emsp;__return__ _&pi;_
37+
&emsp;__until__ _unchanged?_
38+
&emsp;__return__ _&pi;_
3939

4040
---
41-
__Figure ??__ The policy iteration algorithm for calculating an optimal policy.
41+
__Figure ??__ The policy iteration algorithm for calculating an optimal policy.

md/Value-Iteration.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ __Figure ??__ The value iteration algorithm for calculating utilities of states.
2121

2222
---
2323

24-
## AIMA4e
25-
__function__ VALUE-ITERATION(_mdp_, _&epsi;_) __returns__ a utility function
26-
&emsp;__inputs__: _mdp_, an MDP with states _S_, actions _A_(_s_), transition model _P_(_s&prime;_ &vert; _s_, _a_),
27-
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;rewards _R_(_s_,_a_,_s&prime;_), discount _&gamma;_
28-
&emsp;&emsp;&emsp;_&epsi;_, the maximum error allowed in the utility of any state
29-
&emsp;__local variables__: _U_, _U&prime;_, vectors of utilities for states in _S_, initially zero
30-
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;_&delta;_, the maximum change in the utility of any state in an iteration
24+
## AIMA4e
25+
__function__ VALUE-ITERATION(_mdp_, _&epsi;_) __returns__ a utility function
26+
&emsp;__inputs__: _mdp_, an MDP with states _S_, actions _A_(_s_), transition model _P_(_s&prime;_ &vert; _s_, _a_),
27+
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;rewards _R_(_s_,_a_,_s&prime;_), discount _&gamma;_
28+
&emsp;&emsp;&emsp;_&epsi;_, the maximum error allowed in the utility of any state
29+
&emsp;__local variables__: _U_, _U&prime;_, vectors of utilities for states in _S_, initially zero
30+
&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;_&delta;_, the maximum change in the utility of any state in an iteration
3131

32-
&emsp;__repeat__
33-
&emsp;&emsp;&emsp;_U_ &larr; _U&prime;_; _&delta;_ &larr; 0
34-
&emsp;&emsp;&emsp;__for each__ state _s_ in _S_ __do__
35-
&emsp;&emsp;&emsp;&emsp;&emsp;_U&prime;_\[_s_\] &larr; max<sub>_a_ &isin; _A_(_s_)</sub> Q-VALUE(_mdp_,_s_,_a_,_U_)
36-
&emsp;&emsp;&emsp;&emsp;&emsp;__if__ &vert; _U&prime;_\[_s_\] &minus; _U_\[_s_\] &vert; &gt; _&delta;_ __then__ _&delta;_ &larr; &vert; _U&prime;_\[_s_\] &minus; _U_\[_s_\] &vert;
37-
&emsp;__until__ _&delta;_ &lt; _&epsi;_(1 &minus; _&gamma;_)&sol;_&gamma;_
38-
&emsp;__return__ _U_
32+
&emsp;__repeat__
33+
&emsp;&emsp;&emsp;_U_ &larr; _U&prime;_; _&delta;_ &larr; 0
34+
&emsp;&emsp;&emsp;__for each__ state _s_ in _S_ __do__
35+
&emsp;&emsp;&emsp;&emsp;&emsp;_U&prime;_\[_s_\] &larr; max<sub>_a_ &isin; _A_(_s_)</sub> Q-VALUE(_mdp_,_s_,_a_,_U_)
36+
&emsp;&emsp;&emsp;&emsp;&emsp;__if__ &vert; _U&prime;_\[_s_\] &minus; _U_\[_s_\] &vert; &gt; _&delta;_ __then__ _&delta;_ &larr; &vert; _U&prime;_\[_s_\] &minus; _U_\[_s_\] &vert;
37+
&emsp;__until__ _&delta;_ &lt; _&epsi;_(1 &minus; _&gamma;_)&sol;_&gamma;_
38+
&emsp;__return__ _U_
3939

4040
---
4141
__Figure ??__ The value iteration algorithm for calculating utilities of states. The termination condition is from Equation (__??__).

0 commit comments

Comments
 (0)