Synnalagma |
Synnalagma Some other Node class Tanh is for output between -1 and 1 and Gaussian output 0 1: public class NodeGaussian? extends NodeLin? { float x=1f; public NodeGaussian?(int nn,int nly,float b) { super(nn,nly,b); } protected float afn(float x) { this.x=x; return (float) Math.exp(-x*x); } protected float df(float y) { return -2f*x*y; } } public class NodeTanh? extends NodeLin? { public NodeTanh?(int nn,int nly,float b) { super(nn,nly,b); } protected float afn(float x) { return (float) 2f / (1f + (float)Math.exp(-2 * x)) - 1f; } protected float df(float y) { return 1-y*y; } } Synnalagma |