Skip to content

Not good enough accuracy ! #2

Open
@akshath123

Description

@akshath123

Hey! First of all thanks for the tutorial, I have a problem and not able to resolve it.

The accuracy what I have got is around 63% it's not good enough has mentioned in the video so I thought of adding more bidirectional LSTM layers to the existing network to check out the result but I am getting this error. Please help me to resolve this issue.

sequence = Input(shape = (max_len, ), dtype = np.int32)
embedding = Embedding(max_features, embedding_dim, input_length = max_len)(sequence)
batch_norm = BatchNormalization()(embedding)

bi_lstm = Bidirectional(LSTM(lstm_layer_dim))(batch_norm)
drop_out = Dropout(0.25)(bi_lstm)
bi_lstm_1 = Bidirectional(LSTM(lstm_layer_dim_1))(drop_out)
drop_out_1 = Dropout(0.25)(bi_lstm_1)
preds = Dense(2, activation = 'softmax')(drop_out_1)

model = Model(sequence, preds)
model.summary()

The Error which I am getting is this,


IndexError Traceback (most recent call last)
in ()
6 bi_lstm = Bidirectional(LSTM(lstm_layer_dim))(batch_norm)
7 drop_out = Dropout(0.25)(bi_lstm)
----> 8 bi_lstm_1 = Bidirectional(LSTM(lstm_layer_dim_1))(drop_out)
9 drop_out_1 = Dropout(0.25)(bi_lstm_1)
10 preds = Dense(2, activation = 'softmax')(drop_out_1)

C:\Users\Akshath\AppData\Local\Continuum\Anaconda3\envs\py35\lib\site-packages\keras\engine\topology.py in call(self, inputs, **kwargs)
573 'layer.build(batch_input_shape)')
574 if len(input_shapes) == 1:
--> 575 self.build(input_shapes[0])
576 else:
577 self.build(input_shapes)

C:\Users\Akshath\AppData\Local\Continuum\Anaconda3\envs\py35\lib\site-packages\keras\layers\wrappers.py in build(self, input_shape)
322 def build(self, input_shape):
323 with K.name_scope(self.forward_layer.name):
--> 324 self.forward_layer.build(input_shape)
325 with K.name_scope(self.backward_layer.name):
326 self.backward_layer.build(input_shape)

C:\Users\Akshath\AppData\Local\Continuum\Anaconda3\envs\py35\lib\site-packages\keras\layers\recurrent.py in build(self, input_shape)
1015
1016 batch_size = input_shape[0] if self.stateful else None
-> 1017 self.input_dim = input_shape[2]
1018 self.input_spec[0] = InputSpec(shape=(batch_size, None, self.input_dim))
1019

IndexError: tuple index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions