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

LargeLearningTest1() private method

private LargeLearningTest1 ( ) : void
return void
        public void LargeLearningTest1()
        {
            // Create large input vectors

            int rows = 1000;
            int dimension = 10000;

            double[][] inputs = new double[rows][];
            int[] outputs = new int[rows];

            Random rnd = new Random();

            for (int i = 0; i < inputs.Length; i++)
            {
                inputs[i] = new double[dimension];

                if (i > rows / 2)
                {
                    for (int j = 0; j < dimension; j++)
                        inputs[i][j] = rnd.NextDouble();
                    outputs[i] = -1;
                }
                else
                {
                    for (int j = 0; j < dimension; j++)
                        inputs[i][j] = rnd.NextDouble() * 4.21 + 5;
                    outputs[i] = +1;
                }
            }

            KernelSupportVectorMachine svm = new KernelSupportVectorMachine(new Polynomial(2), dimension);

            LeastSquaresLearning smo = new LeastSquaresLearning(svm, inputs, outputs);


            double error = smo.Run();

            Assert.AreEqual(0, error);
        }