Args: predictor_io_names (tuple of list of str): input/output names to predict Q value from state. get_player (-> gym.Env): a callable which returns a player. num_parallel_players (int): number of players to run in parallel.
(self,
predictor_io_names,
get_player,
num_parallel_players,
state_shape,
batch_size,
memory_size, init_memory_size,
update_frequency, history_len,
state_dtype='uint8')
| 276 | """ |
| 277 | |
| 278 | def __init__(self, |
| 279 | predictor_io_names, |
| 280 | get_player, |
| 281 | num_parallel_players, |
| 282 | state_shape, |
| 283 | batch_size, |
| 284 | memory_size, init_memory_size, |
| 285 | update_frequency, history_len, |
| 286 | state_dtype='uint8'): |
| 287 | """ |
| 288 | Args: |
| 289 | predictor_io_names (tuple of list of str): input/output names to |
| 290 | predict Q value from state. |
| 291 | get_player (-> gym.Env): a callable which returns a player. |
| 292 | num_parallel_players (int): number of players to run in parallel. |
| 293 | Standard DQN uses 1. |
| 294 | Parallelism increases speed, but will affect the distribution of |
| 295 | experiences in the replay buffer. |
| 296 | state_shape (tuple): |
| 297 | batch_size (int): |
| 298 | memory_size (int): |
| 299 | init_memory_size (int): |
| 300 | update_frequency (int): number of new transitions to add to memory |
| 301 | after sampling a batch of transitions for training. |
| 302 | history_len (int): length of history frames to concat. Zero-filled |
| 303 | initial frames. |
| 304 | state_dtype (str): |
| 305 | """ |
| 306 | assert len(state_shape) in [1, 2, 3], state_shape |
| 307 | init_memory_size = int(init_memory_size) |
| 308 | |
| 309 | for k, v in locals().items(): |
| 310 | if k != 'self': |
| 311 | setattr(self, k, v) |
| 312 | self.exploration = 1.0 # default initial exploration |
| 313 | |
| 314 | self.rng = get_rng(self) |
| 315 | self._init_memory_flag = threading.Event() # tell if memory has been initialized |
| 316 | |
| 317 | self.mem = ReplayMemory(memory_size, state_shape, self.history_len, dtype=state_dtype) |
| 318 | |
| 319 | def _init_memory(self): |
| 320 | logger.info("Populating replay memory with epsilon={} ...".format(self.exploration)) |
nothing calls this directly
no test coverage detected