Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit 2883626

Browse files
committed
TODO: options of mapping and nb_layers when building models
1 parent c5d2d3c commit 2883626

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

brnn_sequence_analyzer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
It is based on this Keras example - imdb_bidirectional_lstm.py:
1111
https://github.com/fchollet/keras/blob/master/examples/imdb_bidirectional_lstm.py
1212
13+
TODO: options of mapping and nb_layers when building models
14+
1315
Author: Chang Liu (fluency03)
1416
Data: 2016-03-26
1517
"""
@@ -41,7 +43,7 @@ def __init__(self, sentence_length, input_len, hidden_len, output_len):
4143
self.output_len = output_len
4244
self.model = Graph()
4345

44-
def build_lstm(self, dropout=0.2):
46+
def build_lstm(self, mapping='o2o', nb_layers=2, dropout=0.2):
4547
"""
4648
Bidirectional LSTM with specified dropout rate (default 0.2), built with
4749
softmax activation, cross entropy loss and rmsprop optimizer.
@@ -65,7 +67,7 @@ def build_lstm(self, dropout=0.2):
6567
self.model.compile(loss={'output': 'categorical_crossentropy'},
6668
optimizer='rmsprop')
6769

68-
def build_gru(self, dropout=0.2):
70+
def build_gru(self, mapping='o2o', nb_layers=2, dropout=0.2):
6971
"""
7072
Bidirectional GRU with specified dropout rate (default 0.2), built with
7173
softmax activation, cross entropy loss and rmsprop optimizer.

0 commit comments

Comments
 (0)