Accord.Statistics.Links.LogitLinkFunction.Derivative2 C# (CSharp) Method

Derivative2() public method

First derivative of the mean function expressed in terms of it's output.
The first derivative of the Logit link function in terms of y = f(x) is given by y * (1.0 - y).
public Derivative2 ( double y ) : double
y double The reverse transformed value.
return double
        public double Derivative2(double y)
        {
            return y * (1.0 - y);
        }

Usage Example

Ejemplo n.º 1
0
        public void DerivativeTest()
        {
            double[] expected =
            {
                0.25, 0.249376, 0.247517, 0.244458, 0.240261, 0.235004,
                0.228784, 0.221713, 0.21391, 0.2055, 0.196612
            };

            LogitLinkFunction target = new LogitLinkFunction();

            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-6);
                Assert.AreEqual(expected[i], d2, 1e-6);

                Assert.IsFalse(Double.IsNaN(d1));
                Assert.IsFalse(Double.IsNaN(d2));
            }
        }
All Usage Examples Of Accord.Statistics.Links.LogitLinkFunction::Derivative2