当前位置: 首页>>代码示例>>C#>>正文


C# Gaussian.Distance方法代码示例

本文整理汇总了C#中Accord.Statistics.Kernels.Gaussian.Distance方法的典型用法代码示例。如果您正苦于以下问题:C# Gaussian.Distance方法的具体用法?C# Gaussian.Distance怎么用?C# Gaussian.Distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Accord.Statistics.Kernels.Gaussian的用法示例。


在下文中一共展示了Gaussian.Distance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GaussianDistanceTest

        public void GaussianDistanceTest()
        {
            var gaussian = new Gaussian<Linear>(new Linear(0), 1);

            double[] x = { 1, 1 };
            double[] y = { 1, 1 };

            double actual = gaussian.Distance(x, y);
            double expected = 0;

            Assert.AreEqual(expected, actual);


            gaussian = new Gaussian<Linear>(new Linear(0), 11.5);

            x = new double[] { 0.2, 0.5 };
            y = new double[] { 0.3, -0.7 };

            actual = gaussian.Distance(x, y);
            expected = Accord.Statistics.Tools.Distance(gaussian, x, y);

            Assert.AreEqual(expected, actual, 1e-10);
        }
开发者ID:RLaumeyer,项目名称:framework,代码行数:23,代码来源:GaussianLinearTest.cs

示例2: GaussianDistanceTest

        public void GaussianDistanceTest()
        {
            IDistance gaussian = new Gaussian(1);

            double[] x = { 1, 1 };
            double[] y = { 1, 1 };

            double actual = gaussian.Distance(x, y);
            double expected = 0;

            Assert.AreEqual(expected, actual);


            gaussian = new Gaussian(11.5);

            x = new double[] { 0.2, 0.5 };
            y = new double[] { 0.3, -0.7 };

            actual = gaussian.Distance(x, y);
            expected = 341.46531595796711;

            Assert.AreEqual(expected, actual, 1e-10);
        }
开发者ID:huanzl0503,项目名称:framework,代码行数:23,代码来源:GaussianTest.cs

示例3: DistanceTest

        public void DistanceTest()
        {
            Gaussian dense = new Gaussian(3.6);
            SparseGaussian target = new SparseGaussian(3.6);

            double[] sx = { 1, -0.555556, 2, +0.250000, 3, -0.864407, 4, -0.916667 };
            double[] sy = { 1, -0.666667, 2, -0.166667, 3, -0.864407, 4, -0.916667 };
            double[] sz = { 1, -0.944444, 3, -0.898305, 4, -0.916667 };

            double[] dx = { -0.555556, +0.250000, -0.864407, -0.916667 };
            double[] dy = { -0.666667, -0.166667, -0.864407, -0.916667 };
            double[] dz = { -0.944444, +0.000000, -0.898305, -0.916667 };

            double expected, actual;

            expected = dense.Distance(dx, dy);
            actual = target.Distance(sx, sy);
            Assert.AreEqual(expected, actual);

            expected = dense.Distance(dx, dz);
            actual = target.Distance(sx, sz);
            Assert.AreEqual(expected, actual);

            expected = dense.Distance(dy, dz);
            actual = target.Distance(sy, sz);
            Assert.AreEqual(expected, actual);
        }
开发者ID:KommuSoft,项目名称:accord_framework,代码行数:27,代码来源:SparseGaussianTest.cs

示例4: GaussianReverseDistanceTest

        public void GaussianReverseDistanceTest()
        {
            var gaussian = new Gaussian(4.2);

            var x = new double[] { 0.2, 0.5 };
            var y = new double[] { 0.3, -0.7 };

            double expected = Distance.SquareEuclidean(x, y);

            double df = gaussian.Distance(x, y);
            double actual = gaussian.ReverseDistance(df);

            Assert.AreEqual(expected, actual, 1e-10);
        }
开发者ID:KommuSoft,项目名称:accord_framework,代码行数:14,代码来源:GaussianTest.cs


注:本文中的Accord.Statistics.Kernels.Gaussian.Distance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。