aboutsummaryrefslogtreecommitdiff
path: root/R_LogR/mlclass-ex2/sigmoid.m
diff options
context:
space:
mode:
Diffstat (limited to 'R_LogR/mlclass-ex2/sigmoid.m')
-rw-r--r--R_LogR/mlclass-ex2/sigmoid.m18
1 files changed, 18 insertions, 0 deletions
diff --git a/R_LogR/mlclass-ex2/sigmoid.m b/R_LogR/mlclass-ex2/sigmoid.m
new file mode 100644
index 0000000..a79fccd
--- /dev/null
+++ b/R_LogR/mlclass-ex2/sigmoid.m
@@ -0,0 +1,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