Inheritance: Accord.Statistics.Kernels.Gaussian, ITransform
Esempio n. 1
0
        public void ExpandReverseDistanceTest()
        {
            for (int i = 1; i <= 3; i++)
            {
                TaylorGaussian kernel = new TaylorGaussian(i);

                kernel.Degree = 64000;

                var x = new double[] { 0.5, 2.0 };
                var y = new double[] { 1.3, -0.2 };

                var phi_x = kernel.Transform(x);
                var phi_y = kernel.Transform(y);

                double d = Distance.SquareEuclidean(x, y);
                double phi_d = kernel.ReverseDistance(phi_x, phi_y);

                Assert.AreEqual(phi_d, d, 1e-3);
                Assert.IsFalse(double.IsNaN(phi_d));
                Assert.IsFalse(double.IsNaN(d));
            }
        }
Esempio n. 2
0
        public void ExpandDistanceTest()
        {
            for (int i = 1; i <= 3; i++)
            {
                TaylorGaussian kernel = new TaylorGaussian(i);

                kernel.Degree = 64000;

                var x = new double[] { 0.5, 2.0 };
                var y = new double[] { 1.3, -0.2 };

                var phi_x = kernel.Transform(x);
                var phi_y = kernel.Transform(y);

                double d1 = Distance.SquareEuclidean(phi_x, phi_y);
                double d2 = kernel.Distance(x, y);
                double d3 = Accord.Statistics.Tools.Distance(kernel, x, y);

                Assert.AreEqual(d1, d2, 1e-4);
                Assert.AreEqual(d1, d3, 1e-4);
                Assert.IsFalse(double.IsNaN(d1));
                Assert.IsFalse(double.IsNaN(d2));
                Assert.IsFalse(double.IsNaN(d3));
            }
        }