Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Trained network calulates different output with the same input

Discussion in 'ML-Agents' started by StefanBoehm, Aug 8, 2020.

  1. StefanBoehm

    StefanBoehm

    Joined:
    Aug 8, 2019
    Posts:
    3
    Hi Everyone,
    for a study work i must train a neuronal net with reinforcement learning in unity, which can discretly classify specific value intervalls.
    Following a pseudo-code as an Example of my RuleBase:

    Code (CSharp):
    1.  
    2.  
    3. AddReward(-0.05f);
    4. switch(neuronalNetOutput)
    5. case 1:
    6. if( 200 < randomGeneratedNumber < 500) // randomGeneratedNumber is the observed Input
    7. {
    8. SetReward(1.0f);
    9. EndEpisode();
    10. }
    11. else
    12. {
    13. SetReward(-1.0f);
    14. }
    15. case 2:
    16. if( 500 < randomGeneratedNumber < 700)
    17. {
    18. SetReward(1.0f);
    19. EndEpisode();
    20. }
    21. else
    22. {
    23. SetReward(-1.0f);
    24. }
    25.  
    The neuronal net works fine after the Training. But sometimes with the same input like randomGenerated = 490 the neuronal Network Calculates 2 as output instead of 1. This mistake accourd every 30 times or so. Therefore i added the SetRreward(-1.f) function for each case and now it happens once in a thousend calculations.
    The mean reward of my training was at 1, and the deviation at 0.01.

    What could be the reason that a neuronal net, trained with reinforcement learning, can calculate with the exact same input a diffrent output?

    Kind Regards
    Stefan