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

In [2]:
x=np.arange(-5,5,0.1)

In [3]:
x.shape


Out[3]:
(100,)

In [4]:
y=np.tanh(x)

In [5]:
y.shape


Out[5]:
(100,)

Sigmiod (Logistic function)

$f(x)=\frac{e^x}{e^x+1}$


In [6]:
def sigmoid(x):
    y=np.exp(x)/(np.exp(x)+1)
    return y

In [7]:
z=sigmoid(x)

In [8]:
plt.style.use('ggplot')
plt.plot(x,y)
plt.plot(x,z)
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title('tanh(x) and sigmoid(x)')


Out[8]:
<matplotlib.text.Text at 0x113047e48>

In [9]:
x=np.arange(-np.pi,np.pi, 0.1)
y=np.sin(x)
plt.plot(x,y,'o')


Out[9]:
[<matplotlib.lines.Line2D at 0x116241978>]

pcolor


In [10]:
y,x=np.mgrid[slice(0,3),slice(0,3)]

In [11]:
x


Out[11]:
array([[0, 1, 2],
       [0, 1, 2],
       [0, 1, 2]])

In [12]:
y


Out[12]:
array([[0, 0, 0],
       [1, 1, 1],
       [2, 2, 2]])

In [13]:
z=np.random.randint(0,10,(3,3))

In [14]:
plt.pcolor(x,y,z)


Out[14]:
<matplotlib.collections.PolyCollection at 0x11639c860>

In [ ]: