Created
June 30, 2017 09:22
-
-
Save Jim-Holmstroem/a7585fe5f7df2ac2c9a6f55fff7063a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function, division | |
import random | |
import gym | |
import numpy as np | |
from collections import deque | |
from keras.models import Sequential | |
from keras.layers import Dense | |
from keras.optimizers import Adam | |
n_episodes = 16 | |
class DeepQAgent(object): | |
def __init__(self, observation_size, action_size, learning_rate=0.001): | |
self.memory = deque(maxlen=2000) | |
model = Sequential() | |
model.add(Dense(24, input_dim=observation_size, activation='relu')) | |
model.add(Dense(24, activation='relu')) | |
model.add(action_size, activation='linear') | |
model.compile( | |
loss='mse', | |
optimizer=Adam(lr=learning_rate), | |
) | |
self.model = model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment