由一个个被称为“神经元”的基本单元构成,神经元结构由输入、计算单元和输出组成;
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
x = np.linspace(-10,10)
y_sigmoid = 1/(1+np.exp(-x)) # sigmoid函数
y_tanh = (np.exp(x)-np.exp(-x))/(np.exp(x)+np.exp(-x)) # tanh函数
fig = plt.figure()
# plot sigmoid
ax = fig.add_subplot(221)
ax.plot(x,y_sigmoid)
ax.grid()
ax.set_title('(a) Sigmoid')
# plot tanh
ax = fig.add_subplot(222)
ax.plot(x,y_tanh)
ax.grid()
ax.set_title('(b) Tanh')
# plot relu
ax = fig.add_subplot(223)
y_relu = np.array([0*item if item<0 else item for ite