// Adaptive Piecewise Linear public override double Activate(double x, ActivationParameters Params) { APLParams temp = (APLParams)Params; double total = (x < 0) ? 0 : x; for (int i = 1; i <= temp.S; i++) { total += temp.Alpha * ((-x + temp.Beta < 0) ? 0 : -x + temp.Beta); } return(total); }
public override double Derivate(double x, ActivationParameters Params) { APLParams temp = (APLParams)Params; double total = 0; for (int i = 1; i <= temp.S; i++) { total += temp.Alpha * HeavySideStep(-x + temp.Beta); } return(HeavySideStep(x) - total); }