Skip to content

Commit

Permalink
Update IRNN example
Browse files Browse the repository at this point in the history
  • Loading branch information
fchollet committed Nov 29, 2015
1 parent 361a7cf commit df860fd
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions examples/mnist_irnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
Optimizer is replaced with RMSprop which yields more stable and steady
improvement.
Reaches 0.93 train/test accuracy after 900 epochs (which roughly corresponds
to 1687500 steps in the original paper.)
Reaches 0.93 train/test accuracy after 900 epochs
(which roughly corresponds to 1687500 steps in the original paper.)
'''

batch_size = 32
Expand All @@ -34,7 +34,6 @@

learning_rate = 1e-6
clip_norm = 1.0
BPTT_truncate = 28*28

# the data, shuffled and split between train and test sets
(X_train, y_train), (X_test, y_test) = mnist.load_data()
Expand All @@ -58,8 +57,7 @@
model.add(SimpleRNN(output_dim=hidden_units,
init=lambda shape: normal(shape, scale=0.001),
inner_init=lambda shape: identity(shape, scale=1.0),
activation='relu', truncate_gradient=BPTT_truncate,
input_shape=(None, 1)))
activation='relu', input_shape=X_train.shape[1:]))
model.add(Dense(nb_classes))
model.add(Activation('softmax'))
rmsprop = RMSprop(lr=learning_rate)
Expand All @@ -74,7 +72,7 @@

print('Compare to LSTM...')
model = Sequential()
model.add(LSTM(hidden_units, input_shape=(None, 1)))
model.add(LSTM(hidden_units, input_shape=X_train.shape[1:]))
model.add(Dense(nb_classes))
model.add(Activation('softmax'))
rmsprop = RMSprop(lr=learning_rate)
Expand Down

0 comments on commit df860fd

Please sign in to comment.