Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. def dW1(W1, b1, W2, P, Y, X):
  2. """Explanations ??
  3. Returns: A vector which is the derivative of the loss with respect to W1
  4. """
  5. A1 = sigmoid(np.dot(X, W1) + b1)
  6. ones = np.ones(A1.shape)
  7. return np.dot(X.T, np.dot((P-Y), np.dot(W2.T, np.dot(A1.T, (ones-A1)))))
  8.  
  9.  
  10. def db1(W1, b1, W2, P, Y, X):
  11. """Explanations ??
  12. Arguments:
  13. L is the loss af a sample (a scalar)
  14. Returns: A scalar which is the derivative of the Loss with respect to b1
  15. """
  16. A1 = sigmoid(np.dot(X, W1) + b1)
  17. ones = np.ones(A1.shape)
  18. return np.sum(np.dot((P-Y), np.dot(W2.T, np.dot(A1.T, (ones-A1)))), axis=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement