December 2018
Beginner to intermediate
684 pages
21h 9m
English
We will begin by instantiating and extracting key parameters from the LL environment:
env = gym.make('LunarLander-v2')state_dim = env.observation_space.shape[0] # number of dimensions in staten_actions = env.action_space.n # number of actionsmax_episode_steps = env.spec.max_episode_steps # max number of steps per episodeenv.seed(42)
We will also use the built-in wrappers that permit the periodic storing of videos that display the agent's performance:
from gym import wrappersenv = wrappers.Monitor(env,directory=monitor_path.as_posix(),video_callable=lambda count: count % video_freq == 0, force=True)
When running on a server or Docker container without a display, you can use pyvirtualdisplay.