我怎么知道字母S在S型函数中的含义是什么?
1 /(1 + e ^ activationFunction)
在JavaScript中只是
返回1 /(1 + Math.E ^(x)); 还是E不是euleger的号码?
console.log(1/(1+Math.exp(0))); // .5
console.log(1/(1+2.718281828459045^(0))); // 0.3333333333333333
Math.exp肯定可以工作,但是当我执行Math.exp(1)时,我得到2.718281828459045。当我将其插入电源并提升电源时,它会坏吗?
@blgt解决方案
console.log(1/(1+Math.pow(2.718281828459045, 1))); // 0.2689414213699951 It works!
e是欧拉数。在javascript中,使用Math.exp(x)来获取它:
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Math/exp
要在javascript中获得1 /(1 + e ^ x),请使用
var y = 1 / (1 + Math.exp(x)); // y = 1/(1+e^x)
^符号是XOR运算符,请勿与数学指数运算符混淆。要获得基数b的指数n,请使用
Math.pow(b,n);
如果您坚持在使用e之前“提取” e的值,请使用以下命令:
var e = Math.exp(1);
var y = Math.pow(e,x); // = e^x
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句