class_docstr: Asynchronous N-step Q-Learning.
  
  See http://arxiv.org/abs/1602.01783
  
  Args:
      q_function (A3CModel): Model to train
      optimizer (chainer.Optimizer): optimizer used to train the model
      t_max (int): The model is updated after every t_max local steps
      gamma (float): Discount factor [0,1]
      i_target (intn): The target model is updated after every i_target
          global steps
      explorer (Explorer): Explorer to use in training
      phi (callable): Feature extractor function
      average_q_decay (float): Decay rate of average Q, only used for
          recording statistics
      batch_states (callable): method which makes a batch of observations.
          default is `chainerrl.misc.batch_states.batch_states`
class_docstr_tok: ["Asynchronous","N-step","Q-Learning",".","See","http",":","\/\/arxiv.org\/abs\/1602.01783","Args",":","q_function","(","A3CModel",")",":","Model","to","train","optimizer","(","chainer.Optimizer",")",":","optimizer","used","to","train","the","model","t_max","(","int",")",":","The","model","is","updated","after","every","t_max","local","steps","gamma","(","float",")",":","Discount","factor","[","0,1","]","i_target","(","intn",")",":","The","target","model","is","updated","after","every","i_target","global","steps","explorer","(","Explorer",")",":","Explorer","to","use","in","training","phi","(","callable",")",":","Feature","extractor","function","average_q_decay","(","float",")",":","Decay","rate","of","average","Q",",","only","used","for","recording","statistics","batch_states","(","callable",")",":","method","which","makes","a","batch","of","observations",".","default","is","`","chainerrl.misc.batch_states.batch_states","`"]
code: def __init__(
      self,
      q_function,
      optimizer,
      t_max,
      gamma,
      i_target,
      explorer,
      phi=lambda x: x,
      average_q_decay=0.999,
      logger=getLogger(__name__),
      batch_states=batch_states,
  ):
      self.shared_q_function = q_function
      self.target_q_function = copy.deepcopy(q_function)
      self.q_function = copy.deepcopy(self.shared_q_function)
  
      async_.assert_params_not_shared(
          self.shared_q_function, self.q_function
      )
  
      self.optimizer = optimizer
  
      self.t_max = t_max
      self.gamma = gamma
      self.explorer = explorer
      self.i_target = i_target
      self.phi = phi
      self.logger = logger
      self.average_q_decay = average_q_decay
      self.batch_states = batch_states
  
      self.t_global = mp.Value("l", 0)
      self.t = 0
      self.t_start = 0
      self.past_action_values = {}
      self.past_states = {}
      self.past_rewards = {}
      self.average_q = 0
  
imports: import copy
  from logging import getLogger
  import multiprocessing
  import chainer
  from chainer import functions
  import numpy
  from chainerrl.agent import AsyncAgent
  from chainerrl.agent import AttributeSavingMixin
  from chainerrl.misc import async_
  from chainerrl.misc.batch_states import batch_states
  from chainerrl.misc import copy_param
  from chainerrl.recurrent import Recurrent
  from chainerrl.recurrent import state_kept
label_desc: Use image node_id 1 to create a new NSQ object from inherited base classes: AttributeSavingMixin, AsyncAgent with example: obj = NSQ(q_function, optimizer, t_max, gamma, i_target, explorer, phi, average_q_decay, logger, batch_states)