 # 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.zeros() in Pythonnumpy.zeros() in Python

numpy.zeros() in Python The numpy.zeros() function returns a new array of given shape and type, with zeros. Syntax: numpy.zeros(shape, dtype = None, order = 'C') Parameters : shape : integer or sequence of integers order : C_contiguous or F_contiguous C-contiguous order in

## 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 (array elements) along the specified axis. Parameters : arr : [array_like]input array. axis : [int or tuples of int]axis along which we want to calculate the arithmetic

## 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 particular axis. Syntax :  numpy.argmax(array, axis = None, out = None) Parameters :  array : Input array to work on axis : [int, optional]Along a

## How to select rows from a dataframe based on column values ?How to select rows from a dataframe based on column values ?

How to select rows from a dataframe based on column values ? The rows of a dataframe can be selected based on conditions as we do use the SQL queries. The various methods to achieve this is explained in this

## Numpy Meshgrid functionNumpy Meshgrid function

Numpy Meshgrid function The numpy.meshgrid function is used to create a rectangular grid out of two given one-dimensional arrays representing the Cartesian indexing or Matrix indexing. Meshgrid function is somewhat inspired from MATLAB. Consider the above figure with X-axis ranging

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

numpy.linspace() in Python The numpy.linspace() function returns number spaces evenly w.r.t interval. Similar to numpy.arrange() function but instead of step it uses sample number. Syntax :  numpy.linspace(start, stop, num = 50, endpoint = True, retstep = False, dtype = None) Parameters :  -> start

## Python – math.cos() functionPython – math.cos() function

Python | math.cos() function In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.cos() function returns the cosine of value passed as argument. The value passed in this function should be in

## Multiplication of two Matrices in Single line using Numpy in PythonMultiplication of two Matrices in Single line using Numpy in Python

Multiplication of two Matrices in Single line using Numpy in Python Matrix multiplication is an operation that takes two matrices as input and produces single matrix by multiplying rows of the first matrix to the column of the second matrix.In