July 2018
Intermediate to advanced
254 pages
8h 12m
English
Based on the anatomy of the Gym environment we have already discussed, we will now lay out a basic version of a custom environment class implementation named CustomEnv, which will be a subclass of gym.Env and implement the essential methods and arguments required to make it a Gym-compatible environment. A template for a minimal implementation is as follows:
import gymclass CustomEnv(gym.Env): """ A template to implement custom OpenAI Gym environments """ metadata = {'render.modes': ['human']} def __init__(self): self.__version__ = "0.0.1" # Modify the observation space, low, high and shape values according to your custom environment's needs self.observation_space = gym.spaces.Box(low=0.0, ...Read now
Unlock full access