I have a very basic question which relates to Python, numpy and multiplication of matrices in the setting of logistic regression.
First, let me apologise for not using math notation.
I am confused about the use of matrix dot multiplication versus element wise pultiplication. The cost function is given by:
And in python I have written this as
cost = -1/m * np.sum(Y * np.log(A) + (1-Y) * (np.log(1-A)))
But for example this expression (the first one - the derivative of J with respect to w)
dw = 1/m * np.dot(X, dz.T)
I don't understand why it is correct to use dot multiplication in the above, but use element wise multiplication in the cost function i.e why not:
cost = -1/m * np.sum(np.dot(Y,np.log(A)) + np.dot(1-Y, np.log(1-A)))
I fully get that this is not elaborately explained but I am guessing that the question is so simple that anyone with even basic logistic regression experience will understand my problem.