Answers.Body: <p>Here is one way to calculate the exploration rate decay:</p>
  <pre><code>exploration_rate = min_exploration_rate + \ (max_exploration_rate - min_exploration_rate) * np.exp(-exploration_decay_rate*episode)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-29T17:10:09.073Z
Answers.Text: why is exploration_decay_rate negative in np.exp()?
Answers.UserDisplayName: mogoja
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-29T17:14:03.627Z
Answers.Text: on finish of every step of training, exploration rate decreases or decays at a rate proportional to its ongoing decay value. Hence, its negative for every episode.
Answers.UserDisplayName: Rithik Banerjee
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-29T16:47:10.663Z
Answers.LastActivityDate: 2020-07-29T16:47:10.663Z
Answers.UserDisplayName: Rithik Banerjee
Body: <p>I have done creating the virtual environment, creating the Q-table, initializing the q-parameters, then I made a training module and stored it in a <code>numpy</code> array. After completion of training, I have updated the q-table and now I get the plots for the explorations But how can I code for rate decay? Here is my sample code for every step of the training module,</p>
  <pre><code>for step in range(max_steps): 
          exploration_rate_threshold = random.uniform(0,1)
  
          if exploration_rate_threshold &gt; exploration_rate:
              action = np.argmax(q_table[state,:])
          else:
              action = env.action_space.sample()
  </code></pre>
  
Tags: <q-learning>
Title: How can I fetch ​exploration decay rate of an iterable Q-table in Python?
UserDisplayName: mogoja
ThreadText: # How can I fetch ​exploration decay rate of an iterable Q-table in Python?
  
  (Asked by: username_0 on 2020-07-29)
  
  I have done creating the virtual environment, creating the Q-table, initializing the q-parameters, then I made a training module and stored it in a `numpy` array. After completion of training, I have updated the q-table and now I get the plots for the explorations But how can I code for rate decay? Here is my sample code for every step of the training module,
  
  ```
  for step in range(max_steps): 
          exploration_rate_threshold = random.uniform(0,1)
  
          if exploration_rate_threshold > exploration_rate:
              action = np.argmax(q_table[state,:])
          else:
              action = env.action_space.sample()
  
  ```
  
  **Tags:** q-learning
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-07-29. Score: 1 | Accepted answer
  
  Here is one way to calculate the exploration rate decay:
  
  ```
  exploration_rate = min_exploration_rate + \ (max_exploration_rate - min_exploration_rate) * np.exp(-exploration_decay_rate*episode)
  
  ```
  
  > **Comments:**
  > **username_0**: why is exploration_decay_rate negative in np.exp()?  
  > **username_1**: on finish of every step of training, exploration rate decreases or decays at a rate proportional to its ongoing decay value. Hence, its negative for every episode.  
  
  ---
  
  