Inverse() 공개 메소드

The mean (activation) function.
public Inverse ( double x ) : double
x double A transformed value.
리턴 double
예제 #1
0
        public void LogLinkFunctionConstructorTest2()
        {
            LogLinkFunction target = new LogLinkFunction();

            Assert.AreEqual(1, target.B);
            Assert.AreEqual(0, target.A);

            for (int i = 0; i < 11; i++)
            {
                double x = i / 10.0;
                double y = Math.Log(x);

                Assert.AreEqual(y, target.Function(x), 1e-10);
                Assert.AreEqual(x, target.Inverse(y), 1e-10);
            }
        }
예제 #2
0
        public void LogLinkFunctionConstructorTest()
        {
            double beta = 0.52;
            double constant = 2.42;
            LogLinkFunction target = new LogLinkFunction(beta, constant);

            Assert.AreEqual(beta, target.B);
            Assert.AreEqual(constant, target.A);

            for (int i = 0; i < 11; i++)
            {
                double x = i / 10.0;
                double y = (Math.Log(x) - constant) / beta;

                Assert.AreEqual(y, target.Function(x), 1e-10);
                Assert.AreEqual(x, target.Inverse(y), 1e-10);
            }
        }
예제 #3
0
        public void DerivativeTest()
        {
            double beta = 0.52;
            double constant = 2.42;

            double[] expected =
            {
               5.84785, 6.15998, 6.48877, 6.83512, 7.19995, 7.58425, 
               7.98906, 8.41549, 8.86467, 9.33783, 9.83624
            };

            LogLinkFunction target = new LogLinkFunction(beta, constant);

            for (int i = 0; i < 11; i++)
            {
                double x = i / 10.0;
                double y = target.Inverse(x);

                double d1 = target.Derivative(x);
                double d2 = target.Derivative2(y);

                Assert.AreEqual(expected[i], d1, 1e-5);
                Assert.AreEqual(expected[i], d2, 1e-5);

                Assert.IsFalse(Double.IsNaN(d1));
                Assert.IsFalse(Double.IsNaN(d2));
            }
        }