Say I have a RNN-lstm encoder-decoder model trained on fixed timesteps (no padding when training, all sequences are treated as if having the same lengths). My testing criteria requires me to provide input sequences with lengths shorter than the fixed length on which my model was trained. In this case, if I want to use model.predict() to make predictions, I would have to pad the test sequences in order to provide arrays with the same dimensions (which is required by the model.predict() method). I am wondering if it's ok to just stick to model.predict() and pad the shorter sequences if I want to make predictions with shorter test sequences?

  • $\begingroup$ The padding might produce incorrect results, in your case. As your model wasn't trained with padded samples, the model might think of the padding as a "valid input" and make predictions accordingly. $\endgroup$ – Shubham Panchal Nov 18 '20 at 8:29
  • $\begingroup$ I see, thank you. $\endgroup$ – Chung-Hao Ku Nov 18 '20 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.