RL experiments

Reinforcement learning is quickly advancing, and the DQN model we just looked at has quickly become outpaced by more advanced algorithms. There are several variations and advancements in RL algorithms that could fill several chapters, but most of that material would be considered academic. As such, we will instead look at some more practical examples of the various RL models the Keras RL API provides.

The first simple example we can work with is changing our previous example to work with a new gym environment. Open up Chapter_5_5.py and follow the next exercise:

  1. Change the environment name in the following code:
if __name__ == "__main__":
env = gym.make('MountainCar-v0')
  1. In this case, we are going to use the MountainCar environment, as shown:
Example of MountainCar environment
  1. Run the code as you normally would and see how the DQNAgent solves the hill-climbing problem.

You can see how quickly we were able to switch environments and test the DQNAgent in another environment. In the next section, we look at training Atari games with the various RL algorithms that the Keras-RL API provides.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset