Accord.Statistics.Links.LogLinkFunction.Derivative2 C# (CSharp) Метод

Derivative2() публичный Метод

First derivative of the Inverse function expressed in terms of it's output.
public Derivative2 ( double y ) : double
y double The reverse transformed value.
Результат double
        public double Derivative2(double y)
        {
            return B * y;
        }

Usage Example

Пример #1
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));
            }
        }