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]:
In [4]:
y=np.tanh(x)
In [5]:
y.shape
Out[5]:
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]:
In [9]:
x=np.arange(-np.pi,np.pi, 0.1)
y=np.sin(x)
plt.plot(x,y,'o')
Out[9]:
In [10]:
y,x=np.mgrid[slice(0,3),slice(0,3)]
In [11]:
x
Out[11]:
In [12]:
y
Out[12]:
In [13]:
z=np.random.randint(0,10,(3,3))
In [14]:
plt.pcolor(x,y,z)
Out[14]:
In [ ]: