OpenAI Gym Learning

Source: Internet
Author: User

The previous blog introduced OpenAI Gym, OpenAI Gym and intensive learning as well as OpenAI Gym installation, and then run a demo to experience OpenAI Gym this platform to Cartpole (inverted pendulum) as an example, in the working directory to create a Python module , the code is as follows:

Import Gym
env = gym.make (' cartpole-v0 ')
Env.reset () for
_ in range (1000):
    env.render ()
    Env.step (Env.action_space.sample ()) # Take a random action

where Env.reset () resets the state of the Environment, Env.render () redraw a frame of the environment

The result of animation shows that the stochastic control algorithm is divergent and the system loses stability quickly. If you want to see other environments, try replacing the above cartpole-v0 with Mountaincar-v0,mspacman-v0 (which requires a Atari dependency) or HOPPER-V1 (requiring Mujoco dependencies), all from the Env base class.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.