public void ComputeTest2()
{
// Schölkopf KPCA toy example
double[,] inputs = scholkopf();
int[] output = Matrix.Expand(new int[,] { { 1 }, { 2 }, { 3 } },
new int[] { 30, 30, 30 }).GetColumn(0);
IKernel kernel = new Gaussian(0.2);
var target = new KernelDiscriminantAnalysis(inputs, output, kernel);
target.Compute();
double[,] actual = target.Transform(inputs, 2);
double[,] expected1 =
{
{ 1.2785801485080475, 0.20539157505913622},
{ 1.2906613255489541, 0.20704272225753775},
{ 1.2978134597266808, 0.20802649628632208},
};
double[,] actual1 = actual.Submatrix(0, 2, 0, 1);
Assert.IsTrue(Matrix.IsEqual(actual1, expected1, 0.0000001));
// Assert the result equals the transformation of the input
double[,] result = target.Result;
double[,] projection = target.Transform(inputs);
Assert.IsTrue(Matrix.IsEqual(result, projection));
}