class_docstr: The DQN model class.
  DQN paper: https://arxiv.org/abs/1312.5602
  Dueling DQN: https://arxiv.org/abs/1511.06581
  Double-Q Learning: https://arxiv.org/abs/1509.06461
  Prioritized Experience Replay: https://arxiv.org/abs/1511.05952
  
  :param policy: (DQNPolicy or str) The policy model to use (MlpPolicy, CnnPolicy, LnMlpPolicy, ...)
  :param env: (Gym environment or str) The environment to learn from (if registered in Gym, can be str)
  :param gamma: (float) discount factor
  :param learning_rate: (float) learning rate for adam optimizer
  :param buffer_size: (int) size of the replay buffer
  :param exploration_fraction: (float) fraction of entire training period over which the exploration rate is
          annealed
  :param exploration_final_eps: (float) final value of random action probability
  :param exploration_initial_eps: (float) initial value of random action probability
  :param train_freq: (int) update the model every `train_freq` steps. set to None to disable printing
  :param batch_size: (int) size of a batched sampled from replay buffer for training
  :param double_q: (bool) Whether to enable Double-Q learning or not.
  :param learning_starts: (int) how many steps of the model to collect transitions for before learning starts
  :param target_network_update_freq: (int) update the target network every `target_network_update_freq` steps.
  :param prioritized_replay: (bool) if True prioritized replay buffer will be used.
  :param prioritized_replay_alpha: (float)alpha parameter for prioritized replay buffer.
      It determines how much prioritization is used, with alpha=0 corresponding to the uniform case.
  :param prioritized_replay_beta0: (float) initial value of beta for prioritized replay buffer
  :param prioritized_replay_beta_iters: (int) number of iterations over which beta will be annealed from initial
          value to 1.0. If set to None equals to max_timesteps.
  :param prioritized_replay_eps: (float) epsilon to add to the TD errors when updating priorities.
  :param param_noise: (bool) Whether or not to apply noise to the parameters of the policy.
  :param verbose: (int) the verbosity level: 0 none, 1 training information, 2 tensorflow debug
  :param tensorboard_log: (str) the log location for tensorboard (if None, no logging)
  :param _init_setup_model: (bool) Whether or not to build the network at the creation of the instance
  :param full_tensorboard_log: (bool) enable additional logging when using tensorboard
      WARNING: this logging can take a lot of space quickly
  :param seed: (int) Seed for the pseudo-random generators (python, numpy, tensorflow).
      If None (default), use random seed. Note that if you want completely deterministic
      results, you must set `n_cpu_tf_sess` to 1.
  :param n_cpu_tf_sess: (int) The number of threads for TensorFlow operations
      If None, the number of cpu of the current machine will be used.
class_docstr_tok: ["The","DQN","model","class",".","DQN","paper",":","https",":","\/\/arxiv.org\/abs\/1312.5602","Dueling","DQN",":","https",":","\/\/arxiv.org\/abs\/1511.06581","Double-Q","Learning",":","https",":","\/\/arxiv.org\/abs\/1509.06461","Prioritized","Experience","Replay",":","https",":","\/\/arxiv.org\/abs\/1511.05952",":","param","policy",":","(","DQNPolicy","or","str",")","The","policy","model","to","use","(","MlpPolicy",",","CnnPolicy",",","LnMlpPolicy",",","...",")",":","param","env",":","(","Gym","environment","or","str",")","The","environment","to","learn","from","(","if","registered","in","Gym",",","can","be","str",")",":","param","gamma",":","(","float",")","discount","factor",":","param","learning_rate",":","(","float",")","learning","rate","for","adam","optimizer",":","param","buffer_size",":","(","int",")","size","of","the","replay","buffer",":","param","exploration_fraction",":","(","float",")","fraction","of","entire","training","period","over","which","the","exploration","rate","is","annealed",":","param","exploration_final_eps",":","(","float",")","final","value","of","random","action","probability",":","param","exploration_initial_eps",":","(","float",")","initial","value","of","random","action","probability",":","param","train_freq",":","(","int",")","update","the","model","every","`","train_freq","`","steps",".","set","to","None","to","disable","printing",":","param","batch_size",":","(","int",")","size","of","a","batched","sampled","from","replay","buffer","for","training",":","param","double_q",":","(","bool",")","Whether","to","enable","Double-Q","learning","or","not",".",":","param","learning_starts",":","(","int",")","how","many","steps","of","the","model","to","collect","transitions","for","before","learning","starts",":","param","target_network_update_freq",":","(","int",")","update","the","target","network","every","`","target_network_update_freq","`","steps",".",":","param","prioritized_replay",":","(","bool",")","if","True","prioritized","replay","buffer","will","be","used",".",":","param","prioritized_replay_alpha",":","(","float",")","alpha","parameter","for","prioritized","replay","buffer",".","It","determines","how","much","prioritization","is","used",",","with","alpha=0","corresponding","to","the","uniform","case",".",":","param","prioritized_replay_beta0",":","(","float",")","initial","value","of","beta","for","prioritized","replay","buffer",":","param","prioritized_replay_beta_iters",":","(","int",")","number","of","iterations","over","which","beta","will","be","annealed","from","initial","value","to","1.0",".","If","set","to","None","equals","to","max_timesteps",".",":","param","prioritized_replay_eps",":","(","float",")","epsilon","to","add","to","the","TD","errors","when","updating","priorities",".",":","param","param_noise",":","(","bool",")","Whether","or","not","to","apply","noise","to","the","parameters","of","the","policy",".",":","param","verbose",":","(","int",")","the","verbosity","level",":","0","none",",","1","training","information",",","2","tensorflow","debug",":","param","tensorboard_log",":","(","str",")","the","log","location","for","tensorboard","(","if","None",",","no","logging",")",":","param","_init_setup_model",":","(","bool",")","Whether","or","not","to","build","the","network","at","the","creation","of","the","instance",":","param","full_tensorboard_log",":","(","bool",")","enable","additional","logging","when","using","tensorboard","WARNING",":","this","logging","can","take","a","lot","of","space","quickly",":","param","seed",":","(","int",")","Seed","for","the","pseudo-random","generators","(","python",",","numpy",",","tensorflow",")",".","If","None","(","default",")",",","use","random","seed",".","Note","that","if","you","want","completely","deterministic","results",",","you","must","set","`","n_cpu_tf_sess","`","to","1.",":","param","n_cpu_tf_sess",":","(","int",")","The","number","of","threads","for","TensorFlow","operations","If","None",",","the","number","of","cpu","of","the","current","machine","will","be","used","."]
code: def action_probability(
      self, observation, state=None, mask=None, actions=None, logp=False
  ):
      observation = np.array(observation)
      vectorized_env = self._is_vectorized_observation(
          observation, self.observation_space
      )
  
      observation = observation.reshape(
          (-1,) + self.observation_space.shape
      )
      actions_proba = self.proba_step(observation, state, mask)
  
      if (
          actions is not None
      ):  # comparing the action distribution, to given actions
          actions = np.array([actions])
          assert isinstance(self.action_space, gym.spaces.Discrete)
          actions = actions.reshape((-1,))
          assert (
              observation.shape[0] == actions.shape[0]
          ), "Error: batch sizes differ for actions and observations."
          actions_proba = actions_proba[
              np.arange(actions.shape[0]), actions
          ]
          # normalize action proba shape
          actions_proba = actions_proba.reshape((-1, 1))
          if logp:
              actions_proba = np.log(actions_proba)
  
      if not vectorized_env:
          if state is not None:
              raise ValueError(
                  "Error: The environment must be vectorized when using recurrent policies."
              )
          actions_proba = actions_proba[0]
  
      return actions_proba
  
imports: from functools import partial
  import tensorflow
  import numpy
  import gym
  from stable_baselines import logger
  from stable_baselines.common import tf_util, OffPolicyRLModel, SetVerbosity, TensorboardWriter
  from stable_baselines.common.vec_env import VecEnv
  from stable_baselines.common.schedules import LinearSchedule
  from stable_baselines.common.buffers import ReplayBuffer, PrioritizedReplayBuffer
  from stable_baselines.deepq.build_graph import build_train
  from stable_baselines.deepq.policies import DQNPolicy
label_desc: Use image node_id 6 for calling the DQN obj's underlying member method code with example usage: obj.action_probability(observation, state, mask, actions, logp) and returns: actions_proba