-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add contains/2
to Gyx.Core.Spaces
#40
Conversation
Implementation for |
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! I just left two minor change suggestions
lib/core/spaces/protocols.ex
Outdated
alias Gyx.Core.Spaces.{Discrete, Box} | ||
|
||
@type space :: Discrete.t() | Box.t() | ||
@type discete_point :: integer() |
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.
minor typo: discete_point -> discrete_point
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.
Fixed
@@ -0,0 +1,16 @@ | |||
defmodule Gyx.Core.Spaces.Tuple do |
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.
what about something like Gyx.Core.Spaces.List or Vector? to imply that any number of items is possible
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 think these are important decisions. How to name such module, and what data structure use for such implementation.
The motivation for using Tuple
as naming is that it follows the convention on Gym
.
In fact, it represents a fixed size, fixed position structure. Any space is always fixed for a particular environment (its action and observation spaces do not change), but they can differ widely among different environments.
The motivation for NOT using an actual tuple as data structure, is that it is not possible to type spec the elements to be a space :: Gyx.Core.Spaces.Box | Gyx.Core.Spaces.Discrete
And it might be unnatural to construct a tuple structure from parsing a Gym
Tuple
__repr__
(see Gyx.Gym.Utils
where this case must be handled).
That's why I vote to name it Tuple
, having the key spaces
holding a list.
No description provided.