ITPub博客

首页 > IT职业 > IT生活 > JAVA 神经网络 tanh(x),双曲正切函数

JAVA 神经网络 tanh(x),双曲正切函数

IT生活 作者:mouser 时间:2021-09-09 09:02:28 0 删除 编辑

Tanh

    public static double Mytanh(double value) {
        double ex = Math.pow(Math.E, value);// e^x
        double ey = Math.pow(Math.E, -value);//e^(-x)
        double sinhx = ex-ey;
        double coshx = ex+ey;
        double result = sinhx/coshx;
        return result;
    }

Tanh求导

public static double tanhDerivative(double value) {
        double result = 1-Mytanh(value)*Mytanh(value);
        return result;
    }

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3173/viewspace-2807794/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-30

  • 博文量
    84
  • 访问量
    627