aboutsummaryrefslogtreecommitdiff
path: root/R_LogR/mlclass-ex2/sigmoid.m
blob: a79fccd5211411d7d9d4fe1ab1940daed70d124b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function g = sigmoid(z)
%SIGMOID Compute sigmoid functoon
%   J = SIGMOID(z) computes the sigmoid of z.

% You need to return the following variables correctly
% g = zeros(size(z));

% ====================== YOUR CODE HERE ======================
% Instructions: Compute the sigmoid of each value of z (z can be a matrix,
%               vector or scalar).


g = 1 ./ (1 + exp(-z));


% =============================================================

end