Representations#
In GV, states and observations are represented by python objects. In order to
process them using neural network models, we need a way to convert them into
raw numeric form. In GV, this process is performed by the
Representation
classes. A representation converts state/observation spaces into numeric
spaces (as dictionaries of
Space
), and
State
/Observation
into numeric states and observations (as dictionaries of numpy arrays
(ndarray
)
State Representations#
Available state representations can be found in
state_representations
. State
representations must implement the abstract interface
StateRepresentation
,
which requires the implementation of a
space()
property and a
convert()
method:
- class StateRepresentation(state_space)[source]
Converts a
State
into a dictionary ofndarray
.- abstract property space: Dict[str, gym_gridverse.representations.spaces.Space]
returns representation space as as dictionary of numpy arrays
To create one of the representations defined in the GV library, you can use the respective function:
- make_state_representation(name, state_space)[source]
Factory function for state representations
- Parameters
name (str) – name of the representation
state_space (StateSpace) – inner-environment state space
- Return type
Observation Representations#
Available observation representations can be found in
observation_representations
.
Observation representations must implement the abstract interface
ObservationRepresentation
,
which requires the implementation of a
space()
property and a
convert()
- class ObservationRepresentation(observation_space)[source]
Converts a
Observation
into a dictionary ofndarray
.- abstract property space: Dict[str, gym_gridverse.representations.spaces.Space]
returns representation space as as dictionary of numpy arrays
To create one of the representations defined in the GV library, you can use the respective function:
- make_observation_representation(name, observation_space)[source]
Factory function for observation representations
- Parameters
name (str) – name of the representation
observation_space (ObservationSpace) – inner-environment observation space
- Return type