public void ExpandReverseDistanceTest() { Quadratic kernel = new Quadratic(0); 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); }
public void ExpandReverseDistanceWithConstantTest() { Quadratic kernel = new Quadratic(4.2); 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(5.48, phi_d, 1e-10); Assert.AreEqual(5.48, d); Assert.IsFalse(double.IsNaN(phi_d)); Assert.IsFalse(double.IsNaN(d)); }