Examples of creating a simulator by integrating Bonsai's SDK with OpenAI Gym's MountainCar environment
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.test.thresholds.json
LICENSE
README.md
bonsai_brain.bproj
mountaincar.ink
mountaincar_simulator.py
requirements.txt

README.md

OpenAI Gym Mountain Car Sample

A car is on a one-dimensional track, positioned between two "mountains". The goal is to drive up the mountain on the right; however, the car's engine is not strong enough to scale the mountain in a single pass. Therefore, the only way to succeed is to drive back and forth to build up momentum.

WEB GUIDE

If you're using the web interface, please follow the quick start guide.

LOCAL (CLI) GUIDE

CLI INSTALLATION

  1. Install the Bonsai CLI by following our detailed CLI installation guide.

CREATE YOUR BRAIN

  1. Setup your BRAIN's local project folder. bonsai create <your_brain>
  2. Run this command to install additional requirements for training your BRAIN. pip install -r requirements.txt

HOW TO TRAIN YOUR BRAIN

  1. Upload Inkling and simulation files to the Bonsai server with one command. bonsai push
  2. Run this command to start training mode for your BRAIN. bonsai train start If you want to run this remotely on the Bonsai server use the --remote option. bonsai train start --remote
  3. Connect the OpenAI Gym simulator for training. Use the --headless option to hide the graphical output. python mountaincar_simulator.py --train-brain=<your_brain> --headless
  4. When training has hit a sufficient accuracy for prediction, about -40 for at least 100 episodes, stop training your BRAIN. bonsai train stop

GET PREDICTIONS

  1. Run the simulator using predictions from your BRAIN. You can now see AI playing the game! python mountaincar_simulator.py --predict-brain=<your_brain> --predict-version=latest

Questions about Inkling?

See our Inkling Guide and Inkling Reference for help.