Skip to content

Commit 9c08047

Browse files
committed
big ram network
1 parent d593cfa commit 9c08047

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

deep_q_rl/ale_experiment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def _act(self, action):
105105
buffer
106106
107107
"""
108-
reward = self.ale.act(action) + 1 # warning - this changes regular behaviour
108+
reward = self.ale.act(action)
109109
index = self.buffer_count % self.buffer_length
110110

111111
self.ale.getScreenGrayscale(self.screen_buffer[index, ...])

deep_q_rl/q_network.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ def build_network(self, network_type, input_width, input_height,
209209
elif network_type == "ram_dropout":
210210
return self.build_ram_dropout_network(input_width, input_height,
211211
output_dim, num_frames, batch_size)
212+
elif network_type == "big_ram":
213+
return self.build_big_ram_network(input_width, input_height,
214+
output_dim, num_frames, batch_size)
212215
else:
213216
raise ValueError("Unrecognized network: {}".format(network_type))
214217

@@ -487,6 +490,58 @@ def build_ram_network(self, input_width, input_height, output_dim,
487490

488491
return l_out
489492

493+
def build_big_ram_network(self, input_width, input_height, output_dim,
494+
num_frames, batch_size):
495+
"""
496+
Build a 5-layer network using only the information from the ram.
497+
"""
498+
499+
self.l_ram_in = lasagne.layers.InputLayer(
500+
shape=(batch_size, self.RAM_SIZE)
501+
)
502+
503+
l_hidden1 = lasagne.layers.DenseLayer(
504+
self.l_ram_in,
505+
num_units=self.RAM_SIZE,
506+
nonlinearity=lasagne.nonlinearities.rectify,
507+
W=lasagne.init.HeUniform(),
508+
b=lasagne.init.Constant(.1)
509+
)
510+
511+
l_hidden2 = lasagne.layers.DenseLayer(
512+
l_hidden1,
513+
num_units=self.RAM_SIZE,
514+
nonlinearity=lasagne.nonlinearities.rectify,
515+
W=lasagne.init.HeUniform(),
516+
b=lasagne.init.Constant(.1)
517+
)
518+
519+
l_hidden3 = lasagne.layers.DenseLayer(
520+
l_hidden2,
521+
num_units=self.RAM_SIZE,
522+
nonlinearity=lasagne.nonlinearities.rectify,
523+
W=lasagne.init.HeUniform(),
524+
b=lasagne.init.Constant(.1)
525+
)
526+
527+
l_hidden4 = lasagne.layers.DenseLayer(
528+
l_hidden3,
529+
num_units=self.RAM_SIZE,
530+
nonlinearity=lasagne.nonlinearities.rectify,
531+
W=lasagne.init.HeUniform(),
532+
b=lasagne.init.Constant(.1)
533+
)
534+
535+
l_out = lasagne.layers.DenseLayer(
536+
l_hidden4,
537+
num_units=output_dim,
538+
nonlinearity=None,
539+
W=lasagne.init.HeUniform(),
540+
b=lasagne.init.Constant(.1)
541+
)
542+
543+
return l_out
544+
490545
def build_ram_dropout_network(self, input_width, input_height, output_dim,
491546
num_frames, batch_size):
492547
"""

0 commit comments

Comments
 (0)