Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to double check sensor.AddOneHotObservation()

Discussion in 'ML-Agents' started by weight_theta, Aug 22, 2021.

  1. weight_theta

    weight_theta

    Joined:
    Aug 23, 2020
    Posts:
    65
    Hi everyone,

    I would like to double check whether hot-encoded identity I feed the sensor via sensor.AddOneHotObservation() is correct. Therefore I was wondering whether it is possible to examine the what the values that are being fed to the sensor look like. Print and debug.logs do not work, therefore I was wondering whether there is another method to examine whether the hot-encoding is correct.
    In particular, I was wondering whether the AddOneHotObservation, will lead to differences in training since I am currently hot encoding as such:

    Code (CSharp):
    1. sensor.AddObservation(nextTarget == 0 ? 1.0f : 0.0f);
    2. sensor.AddObservation(nextTarget == 1 ? 1.0f : 0.0f);
    3. sensor.AddObservation(nextTarget == 2 ? 1.0f : 0.0f);
    4. sensor.AddObservation(nextTarget == 3 ? 1.0f : 0.0f);
    Id be happy to hear from you.
     
    Last edited: Aug 22, 2021
    datacharmer likes this.
  2. andrewcoh_unity

    andrewcoh_unity

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    162
    Hi @rmnndls

    You can add an int array with sensor.AddObservation and then Debug.Log/print can be used on the int array
     
    weight_theta likes this.