本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}