This article will demonstrate how to conduct reinforcement learning in a broader environment than previously demonstrated. We will be implementing a deep learning technique using Tensorflow.
Note: The following demo requires a graphics rendering library. For the Windows operating system, PyOpenGl, is recommended, and for the Ubuntu operating system — OpenGl .
Step 1: Import required libraries
Step 2: Create Environment
Note. The preloaded environment will be used from the OpenAI gym module, which contains many different environments for different purposes. A list of environments can be viewed at their website .
The & # 39; MountainCar-v0 & # environment will be used here 39 ;. In this case, the car (agent) is stuck between two mountains and must drive uphill on one of them. The car’s engine is not strong enough to drive on its own and therefore needs to gain momentum to climb the hill
Step 3: Building the training agent
The training agent will be built using a deep neural network, and for the same purpose we will use the Sequential class of the Keras module.
Step 4: Finding the optimal strategy
The agent tries different methods to reach the top and thus gain knowledge from each ep isod.
Step 5: Test the training agent
The agent is trying to apply his knowledge to reach the top.