In Course, 5 week 1 assignment 2 in the “sample” function it’s mentioned that y hat <t+1> is a 2D array but why? As y hat t represents the probability of a character (a,b,c…,z,\n) it should be a 1D array with 27 entries like [0.1, 0.2, 0.01…]. What is the meaning of y hat being a 2D array?

Your understanding of theory is correct.

\hat{y} is of shape `(27, 1)`

due to multiplications with proper shapes. This accounts for 2 dimensions. Please implement the `sample`

method to understand this better.

Hint: look for the dimensions after computing `y`

and how they should be used when using `np.random.choice`

Do you mean that \hat{y} should be of shape (27,)?

There are 27 elements of interest in \hat{y}. Output shape `(27, 1)`

is correct from implementation perspective. Please do the math and the 1 will make sense.

I understood it, thanks