In this equations here
I don’t get how it gets converted to this, is A referring to a matrix containing (a - y)?
Then following on I don’t understand in the backpropagation function why db is written as follows
db = 1/m * np.sum(dZ, axis = 1, keepdims = True)
No, A is the vector containing [a^{(1)}, ... a^{(m)}] and Y is the corresponding vector of the y^{(i)} values. So you do an elementwise subtraction of those two vectors and then take the dot product of that result with the matrix X^T, where X has the input samples as the columns of the matrix. Work out what that sequence will give you and you will see that it is the same as the mathematical formula shown above involving the summations.
The code to compute db is a similar process, but also uses this statement to define dZ:
dZ = Y_hat - Y
1 Like