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

Updating the Agent

We are almost done. The last thing we need to do is set up the agent to be aware of the bandits and also return an observation for the current bandit. Open up the SimpleAgent script in your editor, and follow these steps to update the script:

  1. Replace the following field declarations as follows:
      public Bandit bandit; //delete me      public Bandit currentBandit;      public Bandit[] bandits;
  1. Next, we need to update the CollectObservations method as follows:
      public override void CollectObservations()      {        var bandit = Random.Range(0, bandits.Length);        currentBandit = bandits[bandit];        AddVectorObs(bandit);      } 
  1. Here, we are returning the observation of the state the current agent is in. We determine the state by randomly selecting ...

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