标签:func sig soft softmax oid turn function 出现 imu
1.阶跃函数

1 def step_function(x): 2 return np.array(x>0,dtype=np.int)

2.sigmoid函数

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

3.relu函数

1 def relu(x): 2 return np.maximum(0,x)

4.softmax

1 def softmax(x): 2 e_a = np.exp(x) 3 sum_e_a = np.sum(e_a) 4 y=e_a/sum_e_a 5 return y 6 #或者,考虑可能出现内存溢出问题,减去一个常数 7 def softmax(x): 8 c=np.max(x) 9 e_a = np.exp(x-c) 10 sum_e_a = np.sum(e_a) 11 y=e_a/sum_e_a 12 return y

标签:func sig soft softmax oid turn function 出现 imu
原文地址:https://www.cnblogs.com/little-horse/p/11241508.html