You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

sigmoidGradient.m 715 B

8 years ago
123456789101112131415161718192021222324252627282930313233
  1. function g = sigmoidGradient(z)
  2. %SIGMOIDGRADIENT returns the gradient of the sigmoid function
  3. %evaluated at z
  4. % g = SIGMOIDGRADIENT(z) computes the gradient of the sigmoid function
  5. % evaluated at z. This should work regardless if z is a matrix or a
  6. % vector. In particular, if z is a vector or matrix, you should return
  7. % the gradient for each element.
  8. g = zeros(size(z));
  9. % ====================== YOUR CODE HERE ======================
  10. % Instructions: Compute the gradient of the sigmoid function evaluated at
  11. % each value of z (z can be a matrix, vector or scalar).
  12. %g'
  13. g = sigmoid(z) .* (1 - sigmoid(z));
  14. % =============================================================
  15. end

机器学习

Contributors (1)