Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Jim-Holmstroem/a7585fe5f7df2ac2c9a6f55fff7063a2 to your computer and use it in GitHub Desktop.
Save Jim-Holmstroem/a7585fe5f7df2ac2c9a6f55fff7063a2 to your computer and use it in GitHub Desktop.
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