Session Ready
Exercise

Predict the second character

In the previous exercise, you saw how to generate the first character of the suffix sentence using an incomplete prefix sentence. You can append this generated character to the existing output sequence and feed it again to the decoder inference model to generate the second character in the sequence. This you'll do in this exercise. This process can be repeated until you get the end token to generate a complete suffix sentence. The suffix sentence serves as an auto-complete suggestion for the given prefix sentence.

As before, the encoder and decoder inference models are available in encoder_model_inf and decoder_model_inf respectively. The vocabulary and the integer to character mapping are available in vocabulary and idx_to_char.

Instructions
100 XP
  • Use .predict() on decoder inference model to generate the output.
  • Get the most probable next character using np.argmax().
  • Get the character corresponding to the index of the most probable next character.