lauradhamilton / deepqlearning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deep Q Learning Tutorial

In this tutorial, I will walk you through how to use Deep Q Learning to create an AI that learns visually (from pixels) and learns how to drive, solving CarRacing-v0. This software can be adapted with tuning to solve a wide variety of reinforcement learning problems.

Resources

  1. Read the seminal paper Playing Atari with Deep Reinforcement Learning written by the Deepmind team.
  2. Adapted from Deep Q-Learning with Keras and Gym
  3. Uses the Open AI Gym set of reinforcement learning libraries

Language

We will use Python 2.7. Check that you have python installed: python

Libraries

We will use gym for the CarRacing-v0 environment, random for making explore/exploit decisions, numpy for array manipulation, collections for storing our "memory" of past states, and keras for creating the neural nets.

Install the libraries if you do not already have them installed

pip install gym
pip install keras
pip install tensorflow

Now for the code. Create a new file for our code deepqlearning.py. Let's start by importing the libraries we will need:

import gym
import random
import numpy
from collections import deque
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam

Run your file to make sure there are no errors

python deepqlearning.py

About


Languages

Language:Python 100.0%