# Implement sigmoid function using Numpy

## Implement sigmoid function using Numpy

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 :

Last Updated on November 8, 2021 by admin

## numpy.mean() in Pythonnumpy.mean() in Python

numpy.mean() in Python numpy.mean(arr, axis = None) : Compute the arithmetic mean (average) of the given data

## How to inverse a matrix using NumPyHow to inverse a matrix using NumPy

How to inverse a matrix using NumPy The inverse of a matrix is just a

## numpy.argmax() in Pythonnumpy.argmax() in Python

numpy.argmax() in Python The numpy.argmax() function returns indices of the max element of the array in a

## numpy.subtract() in Pythonnumpy.subtract() in Python

numpy.subtract() in Python numpy.subtract() function is used when we want to compute the difference of two

## numpy.multiply() in Pythonnumpy.multiply() in Python

numpy.multiply() in Python numpy.multiply() function is used when we want to compute the multiplication of two

## Convert a NumPy array to a Pandas seriesConvert a NumPy array to a Pandas series

Convert a NumPy array to a Pandas series Let us see how to convert a

## Numpy Meshgrid functionNumpy Meshgrid function

Numpy Meshgrid function The numpy.meshgrid function is used to create a rectangular grid out of

## numpy.percentile() in pythonnumpy.percentile() in python

numpy.percentile() in python numpy.percentile()function used to compute the nth percentile of the given data (array