O'Reilly logo

Learn Unity ML-Agents - Fundamentals of Unity Machine Learning by Micheal Lanham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Training the model

In order for our neural network to fit our Q-learning equation, we need to train it iteratively, typically over thousands of iterations. We do this so that our model (network) can gradually fit the equation to our learning problem without getting stuck at a local minimum or maximum. The parameters we can adjust for training are numerous, and can be complex, but don't worry. Go through the following exercise to finish the sample and train the model:

  1. Enter the following code just beneath the last section:
      policy = EpsGreedyQPolicy()
      memory = SequentialMemory(limit=50000, window_length=1)
      dqn = DQNAgent(model=model, nb_actions=nb_actions, memory=memory, nb_steps_warmup=10, target_model_update=1e-2, policy=policy) dqn.compile(Adam(lr=1e-3), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required