0
点赞
收藏
分享

微信扫一扫

神经网络中的激活函数


为了发挥叠加层所带来的优势,激活函数必须使用非线性函数

阶跃函数

import numpy as np
import matplotlib.pyplot as plt
def step_function(x):
return np.array(x > 0, dtype=int)

x = np.arange(-5.0, 5.0, 0.1)
y = step_function(x)
plt.plot(x, y)
plt.ylim(-0.1, 1.1)
plt.show()

神经网络中的激活函数_Sigmoid

Sigmoid函数

def sigmoid(x):
return 1 / (1 + np.exp(-x))

x = np.arange(-5.0, 5.0, 0.1)
y = sigmoid(x)
plt.plot(x, y)
plt.ylim(-0.1, 1.1)
plt.show()

神经网络中的激活函数_Sigmoid_02

ReLu函数

def ReLU(x):
return np.maximum(0, x)

x = np.arange(-1.0, 1.0, 0.1)
y = ReLU(x)
plt.plot(x, y)
plt.ylim(-0.1, 1.1)
plt.show()

神经网络中的激活函数_ReLu_03


举报

相关推荐

0 条评论