Fast sigmoid algorithm

后端 未结 11 1877
庸人自扰
庸人自扰 2020-12-12 15:55

The sigmoid function is defined as

I found that using the C built-in function exp() to calculate the value of f(x) is slow. Is th

11条回答
  •  执笔经年
    2020-12-12 16:26

    To do the NN more flexible usually used some alpha rate to change the angle of graph around 0.

    The sigmoid function looks like:

    f(x) = 1 / ( 1+exp(-x*alpha))
    

    The nearly equivalent, (but more faster function) is:

    f(x) = 0.5 * (x * alpha / (1 + abs(x*alpha))) + 0.5
    

    You can check the graphs here

    When I using abs function the network become faster 100+ times.

提交回复
热议问题