Implement sigmoid function using Numpy Last Updated : 03 Oct, 2019 Comments Improve Suggest changes Like Article Like Report 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. Python3 1=1 # 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 : Python3 1=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 : Comment More infoAdvertise with us Next Article numpy matrix operations | ones() function J jitender_1998 Follow Improve Article Tags : Technical Scripter Python Python-numpy Practice Tags : python Similar Reads numpy.interp() function - Python numpy.interp() function returns the one-dimensional piecewise linear interpolant to a function with given discrete data points (xp, fp), evaluated at x. Syntax : numpy.interp(x, xp, fp, left = None, right = None, period = None) Parameters : x : [array_like] The x-coordinates at which to evaluate the 2 min read Numpy matrix.I function | Python With the help ofnumpy.matrix.I() function we can get the multiplicative inverse of the same size as of our given matrix. Syntax : numpy.matrix.I() Return : [matrix object] If self is non-singular, ret is such that ret * self == self * ret == np.matrix(np.eye(self[0, :].size) all return True. Return 1 min read numpy.nanstd() function - Python numpy.nanstd() function compute the standard deviation along the specified axis, while ignoring NaNs. Syntax : numpy.nanstd(arr, axis = None, dtype = None, out = None, ddof = 0, keepdims) Parameters : arr : [array_like] Calculate the standard deviation of the non-NaN values. axis : [{int, tuple of i 2 min read numpy.i0() function | Python numpy.i0() function is the modified Bessel function of the first kind, order 0. it's usually denoted by I0. Syntax : numpy.i0(x) Parameters : x : [array_like, dtype float or complex] Argument of the Bessel function. Return : [ndarray, shape = x.shape, dtype = x.dtype] The modified Bessel function ev 1 min read numpy matrix operations | ones() function numpy.matlib.ones() is another function for doing matrix operations in numpy. It returns a matrix of given shape and type, filled with ones. Syntax : numpy.matlib.ones(shape, dtype=None, order='C') Parameters : shape : [int, int] Number of rows and columns in the output matrix.If shape has length on 2 min read numpy matrix operations | rand() function numpy.matlib.rand() is another function for doing matrix operations in numpy. It returns a matrix of random values from a uniform distribution over [0, 1) with given shape. Syntax : numpy.matlib.rand(*args) Parameters : *args : [Arguments] Shape of the output matrix. If given as N integers, each int 2 min read Like