Accord.Statistics.Links.CauchitLinkFunction.Function C# (CSharp) Method

Function() public method

The Cauchit link function.
The Cauchit link function is given by f(x) = tan((x - A) / B).
public Function ( double x ) : double
x double An input value.
return double
        public double Function(double x)
        {
            return Math.Tan((x - A) / B);
        }

Usage Example

Exemplo n.º 1
0
        public void CauchitLinkFunctionConstructorTest()
        {
            CauchitLinkFunction target = new CauchitLinkFunction();
            Assert.AreEqual(0.5, target.A);
            Assert.AreEqual(1 / Math.PI, target.B);

            for (int i = 0; i < 11; i++)
            {
                double x = i / 10.0;
                double y = Math.Tan(Math.PI * (x - 0.5));

                Assert.AreEqual(y, target.Function(x), 1e-10);
                Assert.AreEqual(x, target.Inverse(y), 1e-10);
            }
        }