The sigmoid function is one of the most commonly used activation functions. It scales the value between 0 and 1. The sigmoid function can be defined as follows:
It is an S-shaped curve shown as follows:
It is differentiable, meaning that we can find the slope of the curve at any two points. It is monotonic, which implies it is either entirely non-increasing or non-decreasing. The sigmoid function is also known as a logistic function. As we know that probability lies between 0 and 1 and since the sigmoid function squashes the value between 0 and 1, it is used for predicting the probability of output.
The sigmoid function can be defined in Python as follows:
def sigmoid(x):
return 1/ (1+np.exp(-x))