Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dW1(W1, b1, W2, P, Y, X):
- """Explanations ??
- Returns: A vector which is the derivative of the loss with respect to W1
- """
- A1 = sigmoid(np.dot(X, W1) + b1)
- ones = np.ones(A1.shape)
- return np.dot(X.T, np.dot((P-Y), np.dot(W2.T, np.dot(A1.T, (ones-A1)))))
- def db1(W1, b1, W2, P, Y, X):
- """Explanations ??
- Arguments:
- L is the loss af a sample (a scalar)
- Returns: A scalar which is the derivative of the Loss with respect to b1
- """
- A1 = sigmoid(np.dot(X, W1) + b1)
- ones = np.ones(A1.shape)
- 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