Last active
September 29, 2018 07:36
-
-
Save leohxj/b6d084c5721bffa7b7e2b49c9bf479c4 to your computer and use it in GitHub Desktop.
s曲线收敛函数
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 一个s曲线收敛函数, x可以是负无穷到正无穷的任何值, 输出结构永远在0-1之间, x约小, 结果约趋近于0, 越大, 越趋近于1. | |
| * p值决定s曲线的坡度, 越大曲线约陡峭 | |
| * 使用场景: 性能打分, 要求分数在0-100之间,100分是满分; 一个程序的运行时间t, 越低分越高. | |
| * 那么问题来了, t值是一个0到正无穷之间的取值, 把它映射到0-100分之间 | |
| */ | |
| const sigmoid01 = ( x, p = 1 ) => { | |
| return 1 / ( 1 + Math.pow( Math.E, -x/p) ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment