Answers.Body: <blockquote>
    <p>I do not understand, how to stop the evaluation here, because the policy update is linked to epsilon. So just setting epsilon equal to zero at some point does not seem to make sense to me.</p>
  </blockquote>
  
  <p>If by evaluation you mean the act of exploring new paths, it does not need to stop by changing epsilon to 0 instantly. Instead, in order to facilitate the convergence of the algorithm, the epsilon can be progressively decreased until it reaches 0.</p>
  
  <p>I do not think your question is meant to be related with monte carlo specifically, but if this was not what you wanted to know, please comment.</p>
  
  <blockquote>
    <p>But would not a epsilon value of 0 lead to an unintended policy update?</p>
  </blockquote>
  
  <p>No, a value of epsilon equal to 0 will make you always choose your action according to the policy. I think what is confusing is that the "update" they make to the policy on the last for, is not an update. It is a statement saying the probability of taking such action. What it means is the following:</p>
  
  <p>For action <span class="math-container">$a$</span>, the probability of taking <span class="math-container">$a$</span> in state <span class="math-container">$S_t$</span>, when <span class="math-container">$\epsilon$</span> is 0 is: </p>
  
  <ul>
  <li>1 if action <span class="math-container">$a$</span> is the action with the best value</li>
  <li>0 if action  <span class="math-container">$a$</span> is not the action with the best value</li>
  </ul>
  
  <p>What this means is that when epsilon is 0, the action taken will always be the greedy action.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-29T13:21:45.953Z
Answers.Text: But would not a epsilon value of 0 lead to an unintended policy update?
Answers.UserDisplayName: Jan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-29T13:34:49.850Z
Answers.Text: @Jan I will update my answer give me 5min
Answers.UserDisplayName: Miguel Saraiva
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-29T12:30:58.487Z
Answers.LastActivityDate: 2019-06-29T14:01:28.383Z
Answers.LastEditDate: 2019-06-29T14:01:28.383Z
Answers.UserDisplayName: Miguel Saraiva
Answers.Body: <p>Before answering how to stop the evaluation phase and begin exploitation of those results, one must first answer when to stop it whereby the balance the project stakeholder wants between quality and cost is found. You won't always find that in books discussing pure research, so your question is an excellent one.</p>
  
  <p>The algorithm the authors are discussing on that page (101) is based on the policy improvement theorem on page 78, and the appearance of the endless loop in the algorithm in the pseudo-code line "Repeat forever (for each episode)" is obviously worse than useless in a data center if the loop is not terminated, unless it is multi-agent, exploiting multiple threads, processes, virtual hosts, hardware accelerators, cores, or hosts, and the improvements are accessed for exploitation independently or symbiotically using some scheme.</p>
  
  <p>In a deployed robot, an endless loop often has a legitimate a use case. "Repeat until shutdown," might be appropriate in a production algorithm or hardware embodiment if the robot's goal is, "Keep the living room clean." One must always try to place this theory in context when taking pure research and considering the applied research that may stem from it.</p>
  
  <p>In real product and service development environments, how the balance is struck between quality of action and cost of determining it depends upon the problem size, expectations of the user or business, and the architecture of the computational resources you have. Consider some of these factors in more detail.</p>
  
  <ul>
  <li>Maximum number of rounds of evaluation-exploitation cycles</li>
  <li>Requirements for precision in terms of optimality</li>
  <li>Requirements for reliability in terms of completion</li>
  <li>Distribution of the number branches from nodes</li>
  <li>Distribution of lengths of possible action traversal sequences to the goal</li>
  <li>Average cost (in time and energy) of each evaluation</li>
  <li>Average cost (in time and energy) of each exploitation</li>
  </ul>
  
  <p>In a single thread, single core, von Neumann architecture, as is sometimes the case in an embedded environment, evaluation and exploitation are time sliced. In such a case, evaluation should stop and exploitation should begin when the probability that further evaluation will produce an improved result drops below the cost of further evaluation, based on some estimation of return and cost. This is a function of the above factors, although not a linear one.</p>
  
  <p>We have considered training an LSTM network to determine the function in the epoch domain (roughly related to the time domain), although it is low on our priority list.</p>
  
  <p>In an embedded process, a function that approximates return on further evaluation cost can be constructed, based on statistics gathered up to that point in current learning or over a longer period of operations. The function should be fast and inexpensive. In each cycle within the evaluation phase, the function can be evaluated and compared against a configurable probability threshold. Its configuration value can be an educated guess based on the perception of the value of further path exploration.</p>
  
  <p>In a simulation environment, when more computing resources for parallel processes, exploiting OS or hardware facilities for that, the time slicing is either opaque or nonexistent respectively. In those cases, continuous improvement may be unbounded because the state-action graph is not finite.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-03T02:44:33.847Z
Answers.LastActivityDate: 2019-07-03T02:44:33.847Z
Answers.UserDisplayName: Douglas Daseeco
Body: <p>I have implemented an epsilon-greedy Monte Carlo reinforcement learning agent like suggested in <a href="http://incompleteideas.net/book/the-book-2nd.html" rel="nofollow noreferrer">Sutton and Barto's RL book</a> (page 101). As far as I understood epsilon-greedy agents so far, the evaluation has to stop at some point to exploit the gained knowledge. </p>
  
  <p>I do not understand, how to stop the evaluation here, because the policy update is linked to epsilon. So just setting epsilon equal to zero at some point does not seem to make sense to me.</p>
  
Tags: <reinforcement-learning><q-learning><monte-carlo-methods>
Title: How to stop evaluation phase in reinforcement learning with epsilon-greedy Monte Carlo agent?
UserDisplayName: Jan
ThreadText: # How to stop evaluation phase in reinforcement learning with epsilon-greedy Monte Carlo agent?
  
  (Asked by: username_0 on 2019-06-29)
  
  I have implemented an epsilon-greedy Monte Carlo reinforcement learning agent like suggested in [Sutton and Barto's RL book](http://incompleteideas.net/book/the-book-2nd.html) (page 101). As far as I understood epsilon-greedy agents so far, the evaluation has to stop at some point to exploit the gained knowledge.
  
  I do not understand, how to stop the evaluation here, because the policy update is linked to epsilon. So just setting epsilon equal to zero at some point does not seem to make sense to me.
  
  **Tags:** reinforcement-learning, q-learning, monte-carlo-methods
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-06-29. Score: 0 | Accepted answer
  
  > I do not understand, how to stop the evaluation here, because the policy update is linked to epsilon. So just setting epsilon equal to zero at some point does not seem to make sense to me.
  
  If by evaluation you mean the act of exploring new paths, it does not need to stop by changing epsilon to 0 instantly. Instead, in order to facilitate the convergence of the algorithm, the epsilon can be progressively decreased until it reaches 0.
  
  I do not think your question is meant to be related with monte carlo specifically, but if this was not what you wanted to know, please comment.
  
  > But would not a epsilon value of 0 lead to an unintended policy update?
  
  No, a value of epsilon equal to 0 will make you always choose your action according to the policy. I think what is confusing is that the "update" they make to the policy on the last for, is not an update. It is a statement saying the probability of taking such action. What it means is the following:
  
  For action $a$, the probability of taking $a$ in state $S\_t$, when $\epsilon$ is 0 is:
  
  * 1 if action $a$ is the action with the best value
  * 0 if action $a$ is not the action with the best value
  
  What this means is that when epsilon is 0, the action taken will always be the greedy action.
  
  > **Comments:**
  > **username_0**: But would not a epsilon value of 0 lead to an unintended policy update?  
  > **username_1**: @username_0 I will update my answer give me 5min  
  
  ---
  
  ### Answer by username_2 on 2019-07-03. Score: 0
  
  Before answering how to stop the evaluation phase and begin exploitation of those results, one must first answer when to stop it whereby the balance the project stakeholder wants between quality and cost is found. You won't always find that in books discussing pure research, so your question is an excellent one.
  
  The algorithm the authors are discussing on that page (101) is based on the policy improvement theorem on page 78, and the appearance of the endless loop in the algorithm in the pseudo-code line "Repeat forever (for each episode)" is obviously worse than useless in a data center if the loop is not terminated, unless it is multi-agent, exploiting multiple threads, processes, virtual hosts, hardware accelerators, cores, or hosts, and the improvements are accessed for exploitation independently or symbiotically using some scheme.
  
  In a deployed robot, an endless loop often has a legitimate a use case. "Repeat until shutdown," might be appropriate in a production algorithm or hardware embodiment if the robot's goal is, "Keep the living room clean." One must always try to place this theory in context when taking pure research and considering the applied research that may stem from it.
  
  In real product and service development environments, how the balance is struck between quality of action and cost of determining it depends upon the problem size, expectations of the user or business, and the architecture of the computational resources you have. Consider some of these factors in more detail.
  
  * Maximum number of rounds of evaluation-exploitation cycles
  * Requirements for precision in terms of optimality
  * Requirements for reliability in terms of completion
  * Distribution of the number branches from nodes
  * Distribution of lengths of possible action traversal sequences to the goal
  * Average cost (in time and energy) of each evaluation
  * Average cost (in time and energy) of each exploitation
  
  In a single thread, single core, von Neumann architecture, as is sometimes the case in an embedded environment, evaluation and exploitation are time sliced. In such a case, evaluation should stop and exploitation should begin when the probability that further evaluation will produce an improved result drops below the cost of further evaluation, based on some estimation of return and cost. This is a function of the above factors, although not a linear one.
  
  We have considered training an LSTM network to determine the function in the epoch domain (roughly related to the time domain), although it is low on our priority list.
  
  In an embedded process, a function that approximates return on further evaluation cost can be constructed, based on statistics gathered up to that point in current learning or over a longer period of operations. The function should be fast and inexpensive. In each cycle within the evaluation phase, the function can be evaluated and compared against a configurable probability threshold. Its configuration value can be an educated guess based on the perception of the value of further path exploration.
  
  In a simulation environment, when more computing resources for parallel processes, exploiting OS or hardware facilities for that, the time slicing is either opaque or nonexistent respectively. In those cases, continuous improvement may be unbounded because the state-action graph is not finite.
  
  
  ---
  
  