OpenAI Gym1

OpenAI Gym  is a toolkit for developing and comparing RL algorithms, compatible with other numerical computing libraries, such as tensorflow or theano library. The python language is mainly supported now, and other languages ​​will be supported in the future. Official gym documentation .

1. Composition of OpenAI Gym

Openai gym contains 2 parts:

  • The gym open source 
    contains a set of test questions, each question becomes an environment (environment), which can be used for their own reinforcement learning algorithm development, these environments have a shared interface, allowing users to design common 
    algorithms, such as: Atari, CartPole, etc.
  • The OpenAI Gym service 
    provides a site and api that allows users to compare the performance of the algorithms they have trained.

2. Reinforcement Learning and OpenAI Gym

Reinforcement learning (RL) is a branch of machine learning that considers making a series of decisions. It assumes that an agent exists in the environment. At each step, the agent takes an action and then receives observations and rewards from the environment. An RL algorithm seeks to maximize the overall reward received by the agent through a learning process—often involving many trial-and-errors—in a previously unknown environment. 
write picture description here 
There are two basic concepts in reinforcement learning, one is the environment, called the external world, and the other is the agent (the algorithm written). The agent sends actions to the environment, and the environment returns observations and rewards. The core interface of OpenAI Gym is Env, as a unified environment interface. Env contains the following core methods:

  • env.reset(self): reset the state of the environment, return the observation
  • env.step(self, action): advance a time step, return observation, reward, done, info
  • env.render(self,mode='human',close=False): Redraws a frame of the environment. The default mode is generally friendly, such as popping up a window

3. OpenAI Gym installation

  • Install dependencies
$  apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
  • 1
  • git install
$  git clone https://github.com/openai/gym
$  cd gym
$  pip install -e . # minimal install
or
$  pip install -e .[all] # full install (this requires cmake and a recent pip version)
  • 1
  • 2
  • 3
  • 4
  • 5
  • pip install
$  pip install gym #minimal install
or
$  pip install gym[all] #full install, fetch gym as a package

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326039396&siteId=291194637