hsigmoid激活函数是对sigmoid的近似,尽可能对sigmoid进行拟合。值域为【0,1】,斜率为1/6
公式为:
,相比于sigmoid的指数运算可以节省大量的计算时间。
基于relu函数实现,小于0置0,大于1置1
from keras.utils.generic_utils import get_custom_objects
tmp=0
def hsigmoid(x):
x=x/6+0.5
x=K.relu(x,max_value=1)*x/x
return x
get_custom_objects().update({'hsigmoid': layers.Activation(hsigmoid)})
训练试用
