Open in TheBrain

A Painless Q-Learning Tutorial

<p>May 16, 2015 03:41 PM &nbsp;well written; very clear;</p>

<p>

doors to the outside get an instant reward of 100 (doors 1 and 4)</p>

<p>

room 5 = the outside... an ABSORBING state: &nbsp;agent stays there forever (it loops back on itself)</p>

<p>

See the Matrix R &nbsp;(the reward matrix)</p>

<p>

Below the 6 by 6 matrix R of states and actions:</p>

<p>

Now we'll add a similar <b>matrix, "Q",</b> to the brain of our agent,

representing <b>the memory of what the agent has learned through experience.&nbsp;</b></p>

<p>

The rows of matrix Q represent the current state of the agent, and the columns represent the possible actions leading to the next state (the links between the nodes).</p>

<p>

*</p>

<p>

Q matrix is initially ZERO. &nbsp;(can start with no rows or coumns; then just add them as we discover new ones.)

how to update elements in the matrix:</p>

<p>

The transition rule of Q learning is a very simple formula:</p>

<blockquote >

<p ><b>Q(state, action) = R(state, action) + Gamma * Max[Q(next state, all actions)</b><b>]</b></p>

</blockquote>

<p >According to this formula, a value assigned to a specific element of matrix Q, is equal to the sum of the corresponding value in matrix R and the learning parameter Gamma, multiplied by the

&nbsp;m<b>aximum value of Q for all possible actions in the next state.</b>

<b>(that is, chose that action which maximizes the reward over all possible actions!!!)</b> &nbsp;YES!

*</p>

<p>

look at the pseudo-code computer program: &nbsp;the crux step is...

&nbsp;</p>

<ul >

<li >Select one among <b>all possible actions for the current state</b>.</li>

<li >Using this possible action, consider going to the next state.</li>

<li ><b>Get maximum Q value for this next state based on all possible actions</b>.</li>

<li >Compute: Q(state, action) = R(state, action) + Gamma * Max[Q(next state, all actions)]</li>

</ul>

<p>&nbsp;</p>

<p>

</p>

<p>

&nbsp;</p>

<p>

&nbsp;</p>

<p>

&nbsp;</p>

<p>

&nbsp;</p>

<p>

&nbsp;</p>

<p>

&nbsp;</p>

Attachments