Java实现神经网络激活函数Sigmoid
/**
* @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;
}
}