Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23276

LSTM only predict one class [closed]

$
0
0

I have two models CNN and LSTM. All coding is the same except the architectures. CNN model get 60%+ accuracy while LSTM model only 14%+ accuracy. When I checked confusion matrix, it seems to predict on 1 class only.

Here is my LSTM:

model4 = Sequential()model4.add(Embedding(vocab_size, 100, weights=[embedding_matrix], input_length=max_length))model4.add(SpatialDropout1D(0.2))model4.add(LSTM(128, return_sequences=False))model4.add(Dropout(0.2))model4.add(Dense(20, activation='softmax'))

Reading the same problem, I tried to balance my dataset and change learning rate but not working.


Viewing all articles
Browse latest Browse all 23276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>