Reputation: 21
I am very new to machine learning and was wandering if it’s possible to manually empty an LSTM’s short term memory. Say, for instance, I wanted to train an LSTM on the sentence “Jack and Jill went up the,” but decided not to end the sentence. If I then wanted to train it on “Humpty dumpty sat on a wall,” how would I prevent it from immediately predicting the word “hill”? I’m using Keras.
Upvotes: 1
Views: 269
Reputation: 685
Relevant: When does keras reset an LSTM state?
You should not need to reset context if your LSTM is stateless (stateful = False
, which would make more sense for you I think) or if you train the LSTM on those two sentences by putting both in the same batch.
If you really do, use model.reset_state()
.
Upvotes: 1