ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

Default Action option missing in Brain->Player->Discrete Action Space

Open hsaikia opened this issue 8 years ago • 10 comments

Hi,

The default action under 'Edit the discrete inputs for your actions' is missing in the current main branch. Because of this I am not able to test my agent under the Player Brain. Can anyone confirm if this is true, or am I missing something?

capture

Regards

hsaikia avatar Sep 26 '18 10:09 hsaikia

Hi @hsaikia , thanks for the note. Yes you are correct, we've removed the default action since v0.5. The reason is with discrete action now it is possible that we can have multiple branches, and it would be really verbose if people have to specify multiple default action for each of these branches. Since v0.5, we've made the action index 0 as the default action. Maybe we need to update our migration doc to explain this....

xiaomaogy avatar Sep 26 '18 22:09 xiaomaogy

Hi @xiaomaogy , thanks for the reply. This is fine. I found a workaround for this (which should be possible for everyone else). I indexed my actions starting from 1 and added an extra action. So, for instance, with 4 actions I now set aside space for 5 actions and index my actions from 1 through 4 with 0 being the default.

hsaikia avatar Sep 27 '18 07:09 hsaikia

@hsaikia Yes, that's the standard way of migrating from v0.4 to v0.5 for discrete control. (Actually we did this during our upgrade for all of our example environments. )

xiaomaogy avatar Sep 27 '18 21:09 xiaomaogy

Yeah I ran into the same experience. Might be handy to add to the migration info, or in general to the documentation about branching.

Phantomb avatar Sep 28 '18 13:09 Phantomb

@vincentpierre

xiaomaogy avatar Sep 28 '18 22:09 xiaomaogy

I indexed my actions starting from 1 and added an extra action. So, for instance, with 4 actions I now set aside space for 5 actions and index my actions from 1 through 4 with 0 being the default.

that will work in Player brain type while testing out the inputs...but it fail for when training with External brain type. It messes up the array sequence cos' Tensorflow returns with index of 0, 1, 2...but Player mode starts off with 0 as default, i can't set it to -1.

actually i don't see how default will affect multiple branches...default is a value specifically for AgentAction to ignore when there are no inputs.

araii avatar Oct 04 '18 10:10 araii

When using the External Brain with discrete control, the actions will be an array of indices. If there is one branch with 5 actions (0,1,2,3,4) 0 can be the default (just like with the player brain) and 1,2,3,4 can be the actual actions (example : up, down, right, left). Player Brain and External Brain are supposed to have the same range of possible actions. This is why -1 is no longer the default, because the External Brain could not produce -1. Note that with multi-branches each branch has the default action of 0. Does that answer your question?

vincentpierre avatar Oct 04 '18 17:10 vincentpierre

..ah i see...got it. thanks, i'll just +1 to the indices returned from External brain.

araii avatar Oct 05 '18 02:10 araii

Thanks for reaching out to us. Hopefully you were able to resolve your issue. We are closing this due to inactivity, but if you need additional assistance, feel free to reopen the issue.

xiaomaogy avatar Dec 17 '18 23:12 xiaomaogy

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 02 '20 22:01 lock[bot]