-
Notifications
You must be signed in to change notification settings - Fork 4.3k
[Renaming] SetActionMask -> SetDiscreteActionMask + added the virtual method CollectDiscreteActionMasks #3525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -110,7 +74,7 @@ public void SetActionMask(int branch, IEnumerable<int> actionIndices) | |||
/// </summary> | |||
/// <returns>A mask for the agent. A boolean array of length equal to the total number of | |||
/// actions.</returns> | |||
internal bool[] GetMask() | |||
internal bool[] GetDiscreteActionMask() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK leaving this as GetMask(). The "DiscreteAction" part in the class name seems like enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You think? Why is it different from SetMask()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just think it's redundant. DiscreteActionMasker.GetMask()
and DiscreteActionMasker.GetDiscreteActionMask()
convey the same amount of info. (same for Set...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, not sure we need "discrete" everywhere though.
Discrete.
Co-Authored-By: Chris Elion <chris.elion@unity3d.com>
Co-Authored-By: Chris Elion <chris.elion@unity3d.com>
Co-Authored-By: Chris Elion <chris.elion@unity3d.com>
I will leave this decision to the discretion of the reviewers |
@@ -11,7 +11,7 @@ namespace MLAgents | |||
/// left side of the board). This class represents the set of masked actions and provides | |||
/// the utilities for setting and retrieving them. | |||
/// </summary> | |||
public class ActionMasker | |||
public class DiscreteActionMasker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the file name need to change too?
com.unity.ml-agents/Runtime/Agent.cs
Outdated
@@ -60,7 +60,7 @@ internal struct AgentAction | |||
/// environment. Observations are determined by the cameras attached | |||
/// to the agent in addition to the vector observations implemented by the | |||
/// user in <see cref="Agent.CollectObservations(VectorSensor)"/> or | |||
/// <see cref="Agent.CollectObservations(VectorSensor, ActionMasker)"/>. | |||
/// <see cref="Agent.CollectObservations(VectorSensor, DiscreteActionMasker)"/>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overload no longer exists, right?
Re-requesting reviews because I changed the names again |
com.unity.ml-agents/Runtime/Agent.cs
Outdated
/// this method is called and the resulting size of the vector observation | ||
/// needs to match the vectorObservationSize attribute of the linked Brain. | ||
/// Visual observations are implicitly added from the cameras attached to | ||
/// the Agent. | ||
/// When using Discrete Control, you can prevent the Agent from using a certain | ||
/// action by masking it. You can call the following method on the ActionMasker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still feels a bit redundant; how about something like
/// When using Discrete Control, you can prevent the Agent from using a certain
/// action by masking it with <see cref="DiscreteActionMasker.SetMask(int, IEnumerable{int})"/>
(Remove the "The first argument..." part, since the DiscreteActionMasker docs should cover that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some doc suggestions.
Co-Authored-By: Chris Elion <chris.elion@unity3d.com>
Proposed change(s)
Rename and refactor the ActionMasker class
Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)
Types of change(s)
Checklist
Other comments