0
$\begingroup$

I have a 2-dimensional array of normalized data. I am using

space = np.array([0,1,...366],[0,0.000001,.....1])

I need to fit this as an observation space in reinforcement learning. I have extended the open ai gym and created a custom made environment. How to fit in this 2-dimensional array in openAI spaces. Can I use Box, DiscreteSpace or MultiDiscrete space? Can anyone help me with a sample code to fit this in observation space?

$\endgroup$
1
$\begingroup$

In your case it seems you simply can return a 2D vector and extract out the components for that. You can take a look at the MountainCar example under classic control envs for a fully working case. But something like:

vec_1_low = 0
vec_1_high = 366
vec_2_low = 0
vec_2_high = 1

space_low = np.array([vec_1_low, vec_2_low])

space_high = np.array([vec_1_high, vec_2_high])

obs = spaces.Box(space_low, space_high, dtype=np.float32)

Then:

vec1_obs, vec2_obs = obs.sample()
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.