Accord.Tests.MachineLearning.SequentialMinimalOptimizationTest.SequentialMinimalOptimizationConstructorTest C# (CSharp) Method

SequentialMinimalOptimizationConstructorTest() private method

private SequentialMinimalOptimizationConstructorTest ( ) : void
return void
        public void SequentialMinimalOptimizationConstructorTest()
        {
            double[][] inputs =
            {
                new double[] { -1, -1 },
                new double[] { -1,  1 },
                new double[] {  1, -1 },
                new double[] {  1,  1 }
            };

            int[] or =
            {
                0,
                0,
                0,
                +1
            };

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

            var learn = new SequentialMinimalOptimization(machine, inputs, or);
            learn.Run();

            for (int i = 0; i < inputs.Length; i++)
            {
                bool actual = machine.Decide(inputs[i]);
                Assert.AreEqual(or[i] > 0, actual);
            }
        }