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)

Agent training problems

Before we get into the more advanced techniques used inside Unity's training scripts, we want to understand a little more about how an agent's training can break. Let's open Unity back up to where we left off in the last chapter and see how easily we can break an agent's training using the following steps:

  1. Open Unity to the GridWorld example exercise. If you need help with this, return to the last chapter and review the exercises.
  2. Locate the GridAcademy object and component in the Inspector window and set the values as shown in the following excerpt:
Setting the parameters for the grid example
  1. Set the gridSize to 20, numObstacles to 10, and numGoals to 1, as shown in the preceding screenshot.
  1. Set the GridWorldBrain to use a Player or Heuristic brain.
  2. Press Play to run the sample, and look at the game. You should notice a much larger...