class_docstr: Q-learning agent.
  
  Including:
  - DQN https://storage.googleapis.com/deepmind-media/dqn/DQNNaturePaper.pdf
  - Prioritized Experience Replay https://arxiv.org/pdf/1511.05952.pdf
  - Dueling Network https://arxiv.org/pdf/1511.06581.pdf
  - Double Q Learning https://arxiv.org/pdf/1509.06461.pdf
class_docstr_tok: ["Q-learning","agent",".","Including",":","-","DQN","https",":","\/\/storage.googleapis.com\/deepmind-media\/dqn\/DQNNaturePaper.pdf","-","Prioritized","Experience","Replay","https",":","\/\/arxiv.org\/pdf\/1511.05952.pdf","-","Dueling","Network","https",":","\/\/arxiv.org\/pdf\/1511.06581.pdf","-","Double","Q","Learning","https",":","\/\/arxiv.org\/pdf\/1509.06461.pdf"]
docstr: Perform one minibatch update of Q.
docstr_tok: ["Perform","one","minibatch","update","of","Q","."]
code: def _replay_and_update(self):
      """Perform one minibatch update of Q."""
      input_values = []
      output_values = []
      if self._parameters.use_prioritized_replay:
          # importance sampling weights.
          weight_values = []
  
      minibatch = self._replay_memory.sample_minibatch(
          self._parameters.minibatch_size
      )
      for index_transition_pair in minibatch:
          input_value = index_transition_pair[1].state
  
          # output_value is the same for all actions except last_action.
          output_value = self._evaluate_q(
              self._q, index_transition_pair[1].state
          )
          td_err = self._compute_td_err(
              index_transition_pair[1].state,
              index_transition_pair[1].action,
              index_transition_pair[1].reward,
              index_transition_pair[1].next_state,
          )
          output_value[index_transition_pair[1].action] += td_err
  
          input_values.append(input_value)
          output_values.append(output_value)
  
          if self._parameters.use_prioritized_replay:
              weight_values.append(
                  math.pow(
                      index_transition_pair[1].priority,
                      -self._parameters.priority_beta,
                  )
              )
  
      if self._parameters.use_prioritized_replay:
          w_sum = sum(weight_values)
          weight_values = [[w / w_sum] for w in weight_values]
          self._trainer.train_minibatch(
              {
                  self._input_variables: np.array(input_values).astype(
                      np.float32
                  ),
                  self._output_variables: np.array(
                      output_values
                  ).astype(np.float32),
                  self._weight_variables: np.array(
                      weight_values
                  ).astype(np.float32),
              }
          )
  
          # Update replay priority.
          position_priority_map = {}
          for index_transition_pair in minibatch:
              position_priority_map[
                  index_transition_pair[0]
              ] = self._compute_priority(
                  index_transition_pair[1].state,
                  index_transition_pair[1].action,
                  index_transition_pair[1].reward,
                  index_transition_pair[1].next_state,
              )
  
          self._replay_memory.update_priority(position_priority_map)
      else:
          self._trainer.train_minibatch(
              {
                  self._input_variables: np.array(input_values).astype(
                      np.float32
                  ),
                  self._output_variables: np.array(
                      output_values
                  ).astype(np.float32),
              }
          )
  
imports: import math
  import cntk
  import numpy
  import ast
  from .agent import AgentBaseClass
  from .shared.cntk_utils import huber_loss
  from .shared.models import Models
  from .shared.qlearning_parameters import QLearningParameters
  from .shared.replay_memory import ReplayMemory
label_desc: Use image node_id 14 for calling the QLearning obj's underlying member method code with example usage: obj._replay_and_update() without return types