You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
677 B
Matlab
34 lines
677 B
Matlab
10 years ago
|
function g = sigmoidGradient(z)
|
||
|
%SIGMOIDGRADIENT returns the gradient of the sigmoid function
|
||
|
%evaluated at z
|
||
|
% g = SIGMOIDGRADIENT(z) computes the gradient of the sigmoid function
|
||
|
% evaluated at z. This should work regardless if z is a matrix or a
|
||
|
% vector. In particular, if z is a vector or matrix, you should return
|
||
|
% the gradient for each element.
|
||
|
|
||
|
g = zeros(size(z));
|
||
|
|
||
|
% ====================== YOUR CODE HERE ======================
|
||
|
% Instructions: Compute the gradient of the sigmoid function evaluated at
|
||
|
% each value of z (z can be a matrix, vector or scalar).
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
% =============================================================
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
end
|