class_docstr: William's episodic REINFORCE.
  
  Args:
      model (Policy): Model to train. It must be a callable that accepts
          observations as input and return action distributions
          (Distribution).
      optimizer (chainer.Optimizer): optimizer used to train the model
      beta (float): Weight coefficient for the entropy regularizaiton term.
      normalize_loss_by_steps (bool): If set true, losses are normalized by
          the number of steps taken to accumulate the losses
      act_deterministically (bool): If set true, choose most probable actions
          in act method.
      batchsize (int): Number of episodes used for each update
      backward_separately (bool): If set true, call backward separately for
          each episode and accumulate only gradients.
      average_entropy_decay (float): Decay rate of average entropy. Used only
          to record statistics.
      batch_states (callable): Method which makes a batch of observations.
          default is `chainerrl.misc.batch_states`
      logger (logging.Logger): Logger to be used.
class_docstr_tok: ["William","'s","episodic","REINFORCE",".","Args",":","model","(","Policy",")",":","Model","to","train",".","It","must","be","a","callable","that","accepts","observations","as","input","and","return","action","distributions","(","Distribution",")",".","optimizer","(","chainer.Optimizer",")",":","optimizer","used","to","train","the","model","beta","(","float",")",":","Weight","coefficient","for","the","entropy","regularizaiton","term",".","normalize_loss_by_steps","(","bool",")",":","If","set","true",",","losses","are","normalized","by","the","number","of","steps","taken","to","accumulate","the","losses","act_deterministically","(","bool",")",":","If","set","true",",","choose","most","probable","actions","in","act","method",".","batchsize","(","int",")",":","Number","of","episodes","used","for","each","update","backward_separately","(","bool",")",":","If","set","true",",","call","backward","separately","for","each","episode","and","accumulate","only","gradients",".","average_entropy_decay","(","float",")",":","Decay","rate","of","average","entropy",".","Used","only","to","record","statistics",".","batch_states","(","callable",")",":","Method","which","makes","a","batch","of","observations",".","default","is","`","chainerrl.misc.batch_states","`","logger","(","logging.Logger",")",":","Logger","to","be","used","."]
code: def __init__(
      self,
      model,
      optimizer,
      beta=0,
      phi=lambda x: x,
      batchsize=1,
      act_deterministically=False,
      average_entropy_decay=0.999,
      backward_separately=False,
      batch_states=chainerrl.misc.batch_states,
      logger=None,
  ):
      self.model = model
      self.xp = self.model.xp
      self.optimizer = optimizer
      self.beta = beta
      self.phi = phi
      self.batchsize = batchsize
      self.backward_separately = backward_separately
      self.act_deterministically = act_deterministically
      self.average_entropy_decay = average_entropy_decay
      self.batch_states = batch_states
      self.logger = logger or getLogger(__name__)
  
      # Statistics
      self.average_entropy = 0
  
      self.t = 0
      self.reward_sequences = [[]]
      self.log_prob_sequences = [[]]
      self.entropy_sequences = [[]]
      self.n_backward = 0
  
imports: from logging import getLogger
  import warnings
  import chainer
  import chainer.functions
  import numpy
  import chainerrl
  from chainerrl import agent
  from chainerrl.recurrent import Recurrent
label_desc: Use image node_id 1 to create a new REINFORCE object from inherited base classes: agent, agent with example: obj = REINFORCE(model, optimizer, beta, phi, batchsize, act_deterministically, average_entropy_decay, backward_separately, batch_states, logger)