Book Image

Learn Unity ML-Agents ??? Fundamentals of Unity Machine Learning

Book Image

Learn Unity ML-Agents ??? Fundamentals of Unity Machine Learning

Overview of this book

Unity Machine Learning agents allow researchers and developers to create games and simulations using the Unity Editor, which serves as an environment where intelligent agents can be trained with machine learning methods through a simple-to-use Python API. This book takes you from the basics of Reinforcement and Q Learning to building Deep Recurrent Q-Network agents that cooperate or compete in a multi-agent ecosystem. You will start with the basics of Reinforcement Learning and how to apply it to problems. Then you will learn how to build self-learning advanced neural networks with Python and Keras/TensorFlow. From there you move o n to more advanced training scenarios where you will learn further innovative ways to train your network with A3C, imitation, and curriculum learning models. By the end of the book, you will have learned how to build more complex environments by building a cooperative and competitive multi-agent ecosystem.
Table of Contents (8 chapters)

Deep Q-learning

Now that we understand some of the foundations of neural networks, it will be really helpful to look at a very basic example in Python that demonstrates their use. Go through the following steps to build a neural network that trains an agent with deep Q-learning. Windows users, make sure that you open an Anaconda prompt and switch to the ml-agents environment with activate ml-agents, as we did earlier.

  1. Open a command prompt or shell window to an empty folder and enter the following:
      git clone https://github.com/matthiasplappert/keras-rl.git
      cd keras-rl
      python setup.py install
  1. This will install Keras RL, the reinforcement learning package for Keras. Keras is a popular library for building neural networks and other ML tasks. It can be backed by TensorFlow or Theano. Since we already have TensorFlow installed, we are good.
  2. Enter the following...