adeveloperdiary / blog

http://www.adeveloperdiary.com
80 stars 76 forks source link

Cost Function in Backpropagation_Algorithm_using_Softmax #2

Open Legitao opened 3 years ago

Legitao commented 3 years ago

The line to calculate the cost of Softmax output is not quite correct. Since Y and A are of shape (n_categories, batch_size), the cost should be image

So I think the correct version should be np.mean(-np.sum(Y * np.log(A.T), axis=0))