Answers.Body: <p>Epsilon (your rar parameter) is used to have the possibility of a random action which handles the problem of exploration and exploitation. </p>
  
  <p>If you have a deterministic world and are certain that your learner has learned a policy with performance to your liking, removing it will ensure that only the greedy policy being learned will be taken and that you can expect the same performance afterwards. </p>
  
  <p>The agent will still be learning at this point because alpha (learning rate) is not set to 0. Because of this, if the world is stochastic instead and possibly changes slowly over time (e.g. motor speed due to battery power), then having epsilon non zero still allows the agent to explore and overcome these changes when they happen before it's performance gets low enough to change is behaviour (e.g. q values dropping). </p>
  
  <p>If instead you simply want to test the performance of the policy learned up until a timestep, setting alpha to 0 in a compares the epsilon-greedy policy, setting both alpha and epsilon to 0 compares the greedy policy. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-27T20:52:05.757Z
Answers.LastActivityDate: 2017-04-27T20:52:05.757Z
Answers.UserDisplayName: Jaden Travnik
Body: <p>Learner might be in training stage, where it update Q-table for bunch of epoch.</p>
  
  <p>In this stage, Q-table would be updated with gamma(discount rate), learning rate(alpha), and action would be chosen by random action rate.</p>
  
  <p>After some epoch, when reward is getting stable, let me call this "training is done". Then do I have to ignore these parameters(gamma, learning rate, etc) after that?</p>
  
  <p>I mean, in training stage, I got an action from Q-table like this:</p>
  
  <pre><code>if rand_float &lt; rar:
      action = rand.randint(0, num_actions - 1)
  else:
      action = np.argmax(Q[s_prime_as_index])
  </code></pre>
  
  <p>But after training stage, Do I have to remove <code>rar</code>, which means I have to get an action from Q-table like this?</p>
  
  <pre><code>action = np.argmax(self.Q[s_prime])
  </code></pre>
  
Tags: <machine-learning><deep-learning><reinforcement-learning><q-learning>
Title: Reinforce Learning: Do I have to ignore hyper parameter(?) after training done in Q-learning?
UserDisplayName: user3595632
ThreadText: # Reinforce Learning: Do I have to ignore hyper parameter(?) after training done in Q-learning?
  
  (Asked by: username_0 on 2017-04-25)
  
  Learner might be in training stage, where it update Q-table for bunch of epoch.
  In this stage, Q-table would be updated with gamma(discount rate), learning rate(alpha), and action would be chosen by random action rate.
  After some epoch, when reward is getting stable, let me call this "training is done". Then do I have to ignore these parameters(gamma, learning rate, etc) after that?
  I mean, in training stage, I got an action from Q-table like this:
  if rand_float < rar:
      action = rand.randint(0, num_actions - 1)
  else:
      action = np.argmax(Q[s_prime_as_index])
  
  But after training stage, Do I have to remove rar, which means I have to get an action from Q-table like this?
  action = np.argmax(self.Q[s_prime])
  
  **Tags:** machine-learning, deep-learning, reinforcement-learning, q-learning
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-27. Score: 2
  
  Epsilon (your rar parameter) is used to have the possibility of a random action which handles the problem of exploration and exploitation.
  
  If you have a deterministic world and are certain that your learner has learned a policy with performance to your liking, removing it will ensure that only the greedy policy being learned will be taken and that you can expect the same performance afterwards.
  
  The agent will still be learning at this point because alpha (learning rate) is not set to 0. Because of this, if the world is stochastic instead and possibly changes slowly over time (e.g. motor speed due to battery power), then having epsilon non zero still allows the agent to explore and overcome these changes when they happen before it's performance gets low enough to change is behaviour (e.g. q values dropping).
  
  If instead you simply want to test the performance of the policy learned up until a timestep, setting alpha to 0 in a compares the epsilon-greedy policy, setting both alpha and epsilon to 0 compares the greedy policy.
  
  
  ---
  
  