public void Experiment3()
        {
            Range range = new Range(-5, 5);
            double[][] testPoints = generateRandom2DPoints(range, RANDOM_POINTS_COUNT);

            IFunction function = FunctionsHelper.GetConcreteFunction(FunNumber.F3);
            NeuroBackPropagation backPropagation = new NeuroBackPropagation(generateRandom2DPoints(range, RANDOM_POINTS_COUNT), function);

            WriteResults(function, backPropagation, testPoints, "Function3");
        }
 public void testOneDimensionalFunction(IFunction function, Range range, String filename)
 {
     NeuroBackPropagation backPropagation = new NeuroBackPropagation(to2DArray(generateRandomPoints(range, RANDOM_POINTS_COUNT)), function);
     double[][] testPoints = to2DArray(generateRandomPoints(range, RANDOM_POINTS_COUNT));
     WriteResults(function, backPropagation, testPoints, filename);
 }
        private void WriteResults(IFunction function, NeuroBackPropagation backPropagation, double[][] testPoints, String filename)
        {
            StringBuilder expected = new StringBuilder();
            StringBuilder result = new StringBuilder();

            foreach (double[] xs in testPoints)
            {
                double output = backPropagation.getOutput(xs);

                //			Console.WriteLine(String.format("f(" + Arrays.toString(xs) + ") = %.2f, expected %.2f", output, function.evaluate(xs)));

                expected.Append(StringUtils.Join(xs, " ") + " " + output + "\n");
                result.Append(StringUtils.Join(xs, " ") + " " + function.evaluate(xs) + "\n");
            }

            // Save results to files.
            FileManagement.WriteToFile(outputDirectory + "//neuro_" + filename + "_expected.dat", expected.ToString());
            FileManagement.WriteToFile(outputDirectory + "//neuro_" + filename + "_result.dat", result.ToString());

            // Print Error message.
            double error = backPropagation.getError(testPoints);
            Console.WriteLine("Error = " + error);
        }