A sigmoid function is a mathematical function having a characteristic “S”-shaped curve or sigmoid curve.
import math
def basic_sigmoid(x):
s = 1 / (1 + math.exp(-x))
return s
basic_sigmoid(3)
0.9525741268224334
import numpy as np
def sigmoid(x):
s = 1 / (1 + np.exp(-x))
return s
x = np.array([1, 2, 3])
sigmoid(x)
array([ 0.73105858, 0.88079708, 0.95257413])