Java实现神经网络激活函数Sigmoid

2021-12-24T09:44:00
    /**
     * @Author 。。。源
     * @Email apple_dzy@163.com
     * @Blog https://www.findmyfun.cn
     * @Date 2021/12/24 9:16
     * @Version 1.0
     */
    public class SigmoidUtils {
    
        //Sigmoid 
        public static double sigmoid(double value) {
            //Math.E=e;Math.Pow(a,b)=a^b
            double ey = Math.pow(Math.E, -value);
            double result = 1 / (1 + ey);
            return result;
        }
    
        //Sigmoid 求导
        public static double sigmoidDerivative(double value) {
            double A = sigmoid(value);
            double B = 1 - sigmoid(value);
            double result = A * B;
            return result;
        }
    }
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »