Math optimization in C#

后端 未结 25 2376
悲&欢浪女
悲&欢浪女 2020-12-07 10:25

I\'ve been profiling an application all day long and, having optimized a couple bits of code, I\'m left with this on my todo list. It\'s the activation function for a neural

25条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 11:12

    Doing a Google search, I found an alternative implementation of the Sigmoid function.

    public double Sigmoid(double x)
    {
       return 2 / (1 + Math.Exp(-2 * x)) - 1;
    }
    

    Is that correct for your needs? Is it faster?

    http://dynamicnotions.blogspot.com/2008/09/sigmoid-function-in-c.html

提交回复
热议问题