Beispiel #1
0
        public void LoggyPrimeTest()
        {
            var a = new Matrix(2, 2);

            a.InRandomize();
            var b = a.Duplicate();

            a = new Loggy().Backward(a);
            b.InMap((x) => 1.0 / (Math.Cosh(x) + 1.0));
            Assert.IsTrue(Math.Abs(a.FrobeniusNorm() - b.FrobeniusNorm()) < 0.1,
                          new Loggy().Type().ToString() + " Derivative.");
        }
Beispiel #2
0
        public void LoggyTest()
        {
            var a = new Matrix(2, 2);

            a.InRandomize();
            var b = a.Duplicate();

            a = new Loggy().Forward(a);
            b.InMap((x) => Math.Tanh(x / 2.0));
            Assert.IsTrue(Math.Abs(a.FrobeniusNorm() - b.FrobeniusNorm()) < 0.1,
                          new Loggy().Type().ToString() + " Activation.");
        }