From dc4e89805a642d1c6e3fe031276edbfde3c1f40c Mon Sep 17 00:00:00 2001 From: Suyash Dongre <109069262+Suyashd999@users.noreply.github.com> Date: Mon, 23 Oct 2023 10:57:33 +0530 Subject: [PATCH] Added docstring/documentation for sigmoid_function (#10756) * Added doctest for sigmoid_function * Added doctest for sigmoid_function * Added doctest for sigmoid_function --- machine_learning/logistic_regression.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/machine_learning/logistic_regression.py b/machine_learning/logistic_regression.py index 87bc8f668..f9da0104a 100644 --- a/machine_learning/logistic_regression.py +++ b/machine_learning/logistic_regression.py @@ -28,6 +28,21 @@ from sklearn import datasets def sigmoid_function(z): + """ + Also known as Logistic Function. + + 1 + f(x) = ------- + 1 + e⁻ˣ + + The sigmoid function approaches a value of 1 as its input 'x' becomes + increasing positive. Opposite for negative values. + + Reference: https://en.wikipedia.org/wiki/Sigmoid_function + + @param z: input to the function + @returns: returns value in the range 0 to 1 + """ return 1 / (1 + np.exp(-z))