In [1]:
import numpy as np
import math
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
def sigmoid(x):
    a = []
    for item in x:
        a.append(1/(1+math.exp(-item)))
    return a

In [43]:
x = np.arange(-10, 10, 0.1)
sig = sigmoid(x)

In [53]:
# calculate sigmoid of -6,0,6
sigmoid([-6,0,6])


Out[53]:
[0.0024726231566347743, 0.5, 0.9975273768433653]

In [54]:
#sig

In [55]:
plt.plot(x,sig)
plt.show()



In [ ]: