コード例 #1
0
        public void IdentityLinkFunctionConstructorTest()
        {
            IdentityLinkFunction target = new IdentityLinkFunction();
            Assert.AreEqual(0, target.A);
            Assert.AreEqual(1, target.B);

            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(i, target.Function(i));
                Assert.AreEqual(i, target.Inverse(i));
                Assert.AreEqual(1, target.Derivative(i));
                Assert.AreEqual(1, target.Derivative(i));
            }
        }
コード例 #2
0
        public void IdentityLinkFunctionConstructorTest1()
        {
            double mean = 3.14;
            double variance = 2.91;
            IdentityLinkFunction target = new IdentityLinkFunction(variance, mean);

            Assert.AreEqual(mean, target.A);
            Assert.AreEqual(variance, target.B);

            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual((i - mean) / variance, target.Function(i), 1e-10);
                Assert.AreEqual(i, target.Inverse((i - mean) / variance), 1e-10);
                Assert.AreEqual(variance, target.Derivative(i));
                Assert.AreEqual(variance, target.Derivative(i));
            }

        }