Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
Let's get the CartPole environment from gym
:
env = gym.make('CartPole-v1')
Set the seed for env
:
env.seed(42)
Let's initialize the environment by calling is reset()
method. This returns an observation:
obs = env.<< your code comes here >>()
Print the observation obs
:
print(obs)
As discussed previously, the obs
of CartPole has 4 values:
First value -0.01258566
is the position of the cart.
Second value -0.00156614
is the velocity of the cart.
Third value 0.04207708
is the angle of the pole.
Fourth value -0.00180545
is the angular velocity of the pole.
Let's see what the action space looks like:
print(env.action_space)
It says that CartPole has two values for action
. As discussed previously, 0 means left action, 1 means right action.
For more info on env
, we could do:
help(env)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...