Exemplo n.º 1
0
        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.");
        }
Exemplo n.º 2
0
        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.");
        }