mdp_playground.spaces.image_continuous.ImageContinuous¶
-
class
mdp_playground.spaces.image_continuous.
ImageContinuous
(feature_space, term_spaces=None, width=100, height=100, circle_radius=5, target_point=None, relevant_indices=[0, 1], seed=None, grid_shape=None, dtype=<class 'numpy.uint8'>)[source]¶ Bases:
gym.spaces.box.Box
A space that maps a continuous 1- or 2-D space 1-to-1 to images so that the images may be used as representations for corresponding continuous environments.
-
get_concatenated_image
(continuous_obs)[source]¶ Gets an image representation for a given feature space observation
- Parameters
feature_space (Gym.spaces.Box) – The feature space to which this class associates images as external observations
term_spaces (list of Gym.spaces.Box) – Sub-spaces of the feature space which are terminal
width (int) – The width of the image
height (int) – The height of the image
circle_radius (int) – The radius of the circle which represents the agent and target point
target_point (np.array) –
relevant_indices (list) –
grid_shape (tuple of length 2) –
seed (int) – Seed for this space
-
__init__
(feature_space, term_spaces=None, width=100, height=100, circle_radius=5, target_point=None, relevant_indices=[0, 1], seed=None, grid_shape=None, dtype=<class 'numpy.uint8'>)[source]¶ - Parameters
feature_space (Gym.spaces.Box) – The feature space to which this class associates images as external observations
term_spaces (list of Gym.spaces.Box) – Sub-spaces of the feature space which are terminal
width (int) – The width of the image
height (int) – The height of the image
circle_radius (int) – The radius of the circle which represents the agent and target point
target_point (np.array) –
relevant_indices (list) –
grid_shape (tuple of length 2) –
seed (int) – Seed for this space
Methods
__init__
(feature_space[, term_spaces, …])- param feature_space
The feature space to which this class associates images as external
contains
(x)Return boolean specifying if x is a valid member of this space
convert_to_pixel
(position)from_jsonable
(sample_n)Convert a JSONable data type to a batch of samples from this space.
generate_image
(position[, relevant])- param position
Gets the “stitched together” image made from images corresponding to each continuous sub-space within the continuous space, concatenated along the X-axis.
is_bounded
([manner])sample
()Generates a single random sample inside of the Box.
seed
([seed])Seed the PRNG of this space.
to_jsonable
(sample_n)Convert a batch of samples from this space to a JSONable data type.
-
from_jsonable
(sample_n)[source]¶ Convert a JSONable data type to a batch of samples from this space.
-
get_concatenated_image
(obs)[source]¶ Gets the “stitched together” image made from images corresponding to each continuous sub-space within the continuous space, concatenated along the X-axis.
-
sample
()[source]¶ Generates a single random sample inside of the Box.
In creating a sample of the box, each coordinate is sampled according to the form of the interval:
[a, b] : uniform distribution
[a, oo) : shifted exponential distribution
(-oo, b] : shifted negative exponential distribution
(-oo, oo) : normal distribution
-
seed
(seed=None)¶ Seed the PRNG of this space.
-