Letting the agent drive

We'll start by implementing the nn_agent_drive function, which allows the agent to play the game (defined in https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Python/blob/master/Chapter11/imitation_learning/nn_agent.py). The function will start the env environment with an initial state (game frame). We'll use it as an input to the network. Then, we'll convert the softmax network output from one-hot encoding to an array-based action and we'll send it to the environment to make the next step. We'll repeat these steps until the episode ends. The nn_agent_drive function also allows the user to exit by pressing Escape. Note that we still use the same data_transform transformations as we did for the training. ...

Get Advanced Deep Learning with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.