EvaluateTrain() public static method

Evaluate how long it takes to calculate the error for the network. This causes each of the training pairs to be run through the network. The network is evaluated 10 times and the lowest time is reported.
public static EvaluateTrain ( BasicNetwork network, IMLDataSet training ) : int
network Encog.Neural.Networks.BasicNetwork The training data to use.
training IMLDataSet The number of seconds that it took.
return int
Exemplo n.º 1
0
        /// <summary>
        /// Evaluate the CPU.
        /// </summary>
        private void EvalCpu()
        {
            int small = Evaluate.EvaluateTrain(2, 4, 0, 1);

            _report.Report(Steps, Step1,
                           "Evaluate CPU, tiny= " + Format.FormatInteger(small / 100));

            int medium = Evaluate.EvaluateTrain(10, 20, 0, 1);

            _report.Report(Steps, Step1,
                           "Evaluate CPU, small= " + Format.FormatInteger(medium / 30));

            int large = Evaluate.EvaluateTrain(100, 200, 40, 5);

            _report.Report(Steps, Step1,
                           "Evaluate CPU, large= " + Format.FormatInteger(large));

            int huge = Evaluate.EvaluateTrain(200, 300, 200, 50);

            _report.Report(Steps, Step1,
                           "Evaluate CPU, huge= " + Format.FormatInteger(huge));

            int result = (small / 100) + (medium / 30) + large + huge;

            _report.Report(Steps, Step1,
                           "CPU result: " + result);
            _cpuScore = result;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Evaluate the CPU.
        /// </summary>
        private void EvalCPU()
        {
            int small = Evaluate.EvaluateTrain(2, 4, 0, 1);

            this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP1,
                               "Evaluate CPU, tiny= " + Format.FormatInteger(small / 100));

            int medium = Evaluate.EvaluateTrain(10, 20, 0, 1);

            this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP1,
                               "Evaluate CPU, small= " + Format.FormatInteger(medium / 30));

            int large = Evaluate.EvaluateTrain(100, 200, 40, 5);

            this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP1,
                               "Evaluate CPU, large= " + Format.FormatInteger(large));

            int huge = Evaluate.EvaluateTrain(200, 300, 200, 50);

            this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP1,
                               "Evaluate CPU, huge= " + Format.FormatInteger(huge));

            int result = (small / 100) + (medium / 30) + large + huge;

            this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP1,
                               "CPU result: " + result);
            this.cpuScore = result;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Evaluate the OpenCL device.
        /// </summary>
        private void EvalOpenCL()
        {
            try
            {
                // did the caller assign a device? If not, use the first GPU,
                // failing that,
                // use the first CPU. Failing that, as well, don't test OpenCL.
                if (this.device == null)
                {
                    if (EncogFramework.Instance.CL == null)
                    {
                        EncogFramework.Instance.InitCL();
                    }

                    this.device = EncogFramework.Instance.CL.ChooseDevice();
                }
            }
            catch (Exception)
            {
                this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                                   "No OpenCL devices, result: 0");
                this.clScore = 0;
            }

            int small = 0, medium = 0, large = 0, huge = 0;

            try
            {
                small = Evaluate.EvaluateTrain(device, 2, 4, 0, 1);
                this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                                   "Evaluate OpenCL, tiny= "
                                   + Format.FormatInteger(small / 100));
            }
            catch (Exception)
            {
                this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                                   "Evaluate OpenCL, tiny FAILED");
            }

            try
            {
                medium = Evaluate.EvaluateTrain(device, 10, 20, 0, 1);
                this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                                   "Evaluate OpenCL, small= "
                                   + Format.FormatInteger(medium / 30));
            }
            catch (Exception)
            {
                this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                                   "Evaluate OpenCL, small FAILED");
            }

            try
            {
                large = Evaluate.EvaluateTrain(device, 100, 200, 40, 5);
                this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                                   "Evaluate OpenCL, large= " + Format.FormatInteger(large));
            }
            catch (Exception)
            {
                this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                                   "Evaluate OpenCL, large FAILED");
            }

            try
            {
                huge = Evaluate.EvaluateTrain(device, 200, 300, 200, 50);
                this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                                   "Evaluate OpenCL, huge= " + Format.FormatInteger(huge));
            }
            catch (Exception)
            {
                this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                                   "Evaluate OpenCL, huge FAILED");
            }

            int result = (small / 100) + (medium / 30) + large + huge;

            this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2,
                               "OpenCL result: " + result);
            this.clScore = result;
        }