package net.woodyfolsom.msproj.ann2.math;

public class Sigmoid extends ActivationFunction{
	public static final Sigmoid function = new Sigmoid();
	
	private Sigmoid() {	
		super("Sigmoid");
	}
	
	public double calculate(double arg) {
		return 1.0 / (1 + Math.pow(Math.E, -1.0 * arg));
	}

	public double derivative(double arg) {
		//lol wth?
		//double eX = Math.exp(arg);
		//return eX / (Math.pow((1+eX), 2));
		return arg - Math.pow(arg,2);
	}
}