Programming Machine Learning - Dimension numbers correct? (page 118)

Hi @nusco,

I have a question regarding the dimension numbers of the matrices shown in the picture on page 118. What I am currently struggling with is, node “h_0” is used for bias purpose (which means constant value 1). So if weight vector w_1 has 201 columns, this implies that all hidden nodes h_0, h_1, … h_200 are calculated via w_1 … but looking in the code-snipets on page 122,

h = sigmoid(np.matmul(prepend_bias(X), w1))

vector h should have 202 entries, if w1 has 201, which doesn’t fit into the picture of page 118, or?

Thanks a lot,
Mscdit

1 Like

Here I am, at long last! Sorry for the slow reply, @mscdit . I was knocked out by the flu.

This looks indeed like a mistake in that diagram (that is even repeated in two consecutive chapters). w1 should be (785, 200), not (785, 201). Then the hidden layer is (M, 200), and it becomes (M, 201) when you prepend the biases.

Thank you for spotting it! I’ll add to the errata for future editions.