public void BipolarSigmoidPrimeTest() { var a = new Matrix(2, 2); a.InRandomize(); var b = a.Duplicate(); a = new BipolarSigmoid().Backward(a); b.InMap((x) => 0.5 * (1 + (-1 + 2 / (1 + Math.Exp(-x)))) * (1 - (-1 + 2 / (1 + Math.Exp(-x))))); Assert.IsTrue(Math.Abs(a.FrobeniusNorm() - b.FrobeniusNorm()) < 0.1, new BipolarSigmoid().Type().ToString() + " Derivative."); }
public void BipolarSigmoidTest() { var a = new Matrix(2, 2); a.InRandomize(); var b = a.Duplicate(); a = new BipolarSigmoid().Forward(a); b.InMap((x) => - 1 + 2 / (1 + Math.Exp(-x))); Assert.IsTrue(Math.Abs(a.FrobeniusNorm() - b.FrobeniusNorm()) < 0.1, new BipolarSigmoid().Type().ToString() + " Activation."); }