December 2018
Intermediate to advanced
764 pages
18h 18m
English
In the DQN, we replace the Q-Table with a neural network (Q-Network) that will learn to respond with the optimal action as we train it continuously with the explored states and their Q-Values. Thus, for training the network we need a place to store the game memory:
memory = deque(maxlen=1000)
from keras.models import Sequentialfrom keras.layers import Densemodel = Sequential()model.add(Dense(8,input_dim=4, activation='relu'))model.add(Dense(2, activation='linear'))model.compile(loss='mse',optimizer='adam')model.summary()q_nn = model
The Q-Network looks like this:
_________________________________________________________________ ...
Read now
Unlock full access