Sequence Models Week 1

Hi, I’m really stuck on week 1 exercise 2 part 2.2 Sampling. The instructions are much less clear than previous exercises. It’s not clear what shape the zero vectors should be for step 1, for step 2 I end up with a shape of 27,100 and the probabilities don’t add up to 100 - is that correct? For step 3 the function says a and p must be the same size, but I have a vector of 27 charactors and a y matrix of 27,100 - how to get that to match (ravel is no use) and which vector do I use for the range?
There is no guidance on the shapes of the different variables so this is very tough. Please help!

Here are some hints:

  1. x should be one-hot representation of a character. There are vocab_size number of characters in total.
  2. Looking at the forward propagation equations, a_prev should be compatible with W_{aa} to perform dot product.
  3. y holds the probability of the next character. So, use this to sample from the characters that make up the vocabulary.

The problem is that is not the correct shape of y. You need to carefully check your computations against the given formulas. Here’s a thread which shows the shapes you should be getting.