Skip to content

Commit 55ce5b4

Browse files
Suyashd999sedatguzelsemme
authored andcommitted
Added docstring/documentation for sigmoid_function (TheAlgorithms#10756)
* Added doctest for sigmoid_function * Added doctest for sigmoid_function * Added doctest for sigmoid_function
1 parent f8ff13f commit 55ce5b4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: machine_learning/logistic_regression.py

+15
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@
2828

2929

3030
def sigmoid_function(z):
31+
"""
32+
Also known as Logistic Function.
33+
34+
1
35+
f(x) = -------
36+
1 + e⁻ˣ
37+
38+
The sigmoid function approaches a value of 1 as its input 'x' becomes
39+
increasing positive. Opposite for negative values.
40+
41+
Reference: https://en.wikipedia.org/wiki/Sigmoid_function
42+
43+
@param z: input to the function
44+
@returns: returns value in the range 0 to 1
45+
"""
3146
return 1 / (1 + np.exp(-z))
3247

3348

0 commit comments

Comments
 (0)