Related Articles
Implement sigmoid function using Numpy
• Last Updated : 03 Oct, 2019

With the help of Sigmoid activation function, we are able to reduce the loss during the time of training because it eliminates the gradient problem in machine learning model while training. `# Import matplotlib, numpy and math``import` `matplotlib.pyplot as plt``import` `numpy as np``import` `math`` ` `x ``=` `np.linspace(``-``10``, ``10``, ``100``)``z ``=` `1``/``(``1` `+` `np.exp(``-``x))`` ` `plt.plot(x, z)``plt.xlabel(``"x"``)``plt.ylabel(``"Sigmoid(X)"``)`` ` `plt.show()`

Output : Example #1 :

 `# Import matplotlib, numpy and math``import` `matplotlib.pyplot as plt``import` `numpy as np``import` `math`` ` `x ``=` `np.linspace(``-``100``, ``100``, ``200``)``z ``=` `1``/``(``1` `+` `np.exp(``-``x))`` ` `plt.plot(x, z)``plt.xlabel(``"x"``)``plt.ylabel(``"Sigmoid(X)"``)`` ` `plt.show()`

Output : Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up