1
2 /**
3 * Calculates S-curve for point x in the interval 0 .. normV
4 *
5 * @param x input coordinate
6 * @param normV scale value which corresponds to 1.0 if x is normalized
7 * @param sharpness adjusts steepness of curve (value of 1 equals undistorted sigmoid)
8 *
9 * @return sigmoid for point X
10 */
11 public float sigmoid(float x, float normV, float sharpness) {
12 x=(x/normV*2-1)*5*sharpness;
13 return 1.0f / (1.0f + (float)Math.exp(-x));
14 }
15
16 public double sigmoid(double x, double normV, double sharpness) {
17 x=(x/normV*2-1)*5*sharpness;
18 return 1.0 / (1.0 + Math.exp(-x));
19 }