parameters: (self)
docstring: This allows the agent to train itself to better understand the environment dynamics.
          The agent will compute the expected reward for the state(t+1)
          and update the expected reward at step t according to this.
  
          The target expectation is computed through the Target Network, which is a more stable version
          of the Action Value Network for increasing training stability.
  
          The Target Network is a frozen copy of the Action Value Network updated as regular intervals.
docstring_summary: This allows the agent to train itself to better understand the environment dynamics.
          The agent will compute the expected reward for the state(t+1)
          and update the expected reward at step t according to this.
docstring_tokens: This allows the agent to train itself to better understand the environment dynamics . The agent will compute the expected reward for the state ( t + 1 ) and update the expected reward at step t according to this .
function: def train(self):
          """ This allows the agent to train itself to better understand the environment dynamics.
          The agent will compute the expected reward for the state(t+1)
          and update the expected reward at step t according to this.
  
          The target expectation is computed through the Target Network, which is a more stable version
          of the Action Value Network for increasing training stability.
  
          The Target Network is a frozen copy of the Action Value Network updated as regular intervals.
          """
  
          agent_step = self._num_actions_taken
  
          if agent_step >= self._train_after:
              if (agent_step % self._train_interval) == 0:
                  pre_states, actions, post_states, rewards, terminals = self._memory.minibatch(self._minibatch_size)
  
                  self._trainer.train_minibatch(
                      self._trainer.loss_function.argument_map(
                          pre_states=pre_states,
                          actions=Value.one_hot(actions.reshape(-1, 1).tolist(), self.nb_actions),
                          post_states=post_states,
                          rewards=rewards,
                          terminals=terminals
                      )
                  )
  
                  # Update the Target Network if needed
                  if (agent_step % self._target_update_interval) == 0:
                      self._target_net = self._action_value_net.clone(CloneMethod.freeze)
function_tokens: def train ( self ) : agent_step = self . _num_actions_taken if agent_step >= self . _train_after : if ( agent_step % self . _train_interval ) == 0 : pre_states , actions , post_states , rewards , terminals = self . _memory . minibatch ( self . _minibatch_size ) self . _trainer . train_minibatch ( self . _trainer . loss_function . argument_map ( pre_states = pre_states , actions = Value . one_hot ( actions . reshape ( - 1 , 1 ) . tolist ( ) , self . nb_actions ) , post_states = post_states , rewards = rewards , terminals = terminals ) ) # Update the Target Network if needed if ( agent_step % self . _target_update_interval ) == 0 : self . _target_net = self . _action_value_net . clone ( CloneMethod . freeze )