Accord.Tests.MachineLearning.LeastSquaresLearningTest.LearnTest2 C# (CSharp) Method

LearnTest2() private method

private LearnTest2 ( ) : void
return void
        public void LearnTest2()
        {
            double[][] inputs = yinyang.Submatrix(null, 0, 1).ToJagged();
            int[] outputs = yinyang.GetColumn(2).ToInt32();

            // Create Kernel Support Vector Machine with a Polynomial Kernel of 2nd degree
            KernelSupportVectorMachine machine = new KernelSupportVectorMachine(new Polynomial(3), inputs[0].Length);

            // Create the Least Squares Support Vector Machine teacher
            LeastSquaresLearning learn = new LeastSquaresLearning(machine, inputs, outputs);
            learn.Complexity = 1 / 0.1;

            // Run the learning algorithm
            learn.Run();


            int[] output = inputs.Apply(p => Math.Sign(machine.Compute(p)));

            for (int i = 0; i < output.Length; i++)
                Assert.AreEqual(System.Math.Sign(outputs[i]), System.Math.Sign(output[i]));
        }