Пример #1
0
        /// <summary>
        /// Evaluate memory.
        /// </summary>
        private void EvalMemory()
        {
            BasicNeuralDataSet training = RandomTrainingFactory.Generate(
                1000, 10000, 10, 10, -1, 1);

            long stop   = (10 * Evaluate.MILIS);
            int  record = 0;

            INeuralDataPair pair = BasicNeuralDataPair.CreatePair(10, 10);

            int       iterations = 0;
            Stopwatch watch      = new Stopwatch();

            watch.Start();
            while (watch.ElapsedMilliseconds < stop)
            {
                iterations++;
                training.GetRecord(record++, pair);
                if (record >= training.Count)
                {
                    record = 0;
                }
            }

            iterations /= 100000;

            this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP3,
                               "Memory dataset, result: " + Format.FormatInteger(iterations));

            this.memoryScore = iterations;
        }
Пример #2
0
        /// <inheritdoc/>
        public void Write(double[] input, double[] ideal)
        {
            INeuralDataPair pair = BasicNeuralDataPair.CreatePair(inputSize,
                                                                  idealSize);

            EngineArray.ArrayCopy(input, pair.Input.Data);
            EngineArray.ArrayCopy(ideal, pair.Ideal.Data);
        }
Пример #3
0
 /// <summary>
 /// Move to the next record.
 /// </summary>
 /// <returns>True, if we were able to move to the next record.</returns>
 public bool MoveNext()
 {
     if (HasNext())
     {
         INeuralDataPair pair = BasicNeuralDataPair.CreatePair(
             this.owner.InputSize, this.owner.IdealSize);
         this.owner.GetRecord(this.currentIndex++, pair);
         this.currentPair = pair;
         return(true);
     }
     else
     {
         this.currentPair = null;
         return(false);
     }
 }
Пример #4
0
        /// <summary>
        /// Evaluate disk.
        /// </summary>
        private void EvalBinary()
        {
            String file = "temp.egb";

            BasicNeuralDataSet training = RandomTrainingFactory.Generate(
                1000, 10000, 10, 10, -1, 1);

            // create the binary file

            File.Delete(file);

            BufferedNeuralDataSet training2 = new BufferedNeuralDataSet(file);

            training2.Load(training);

            long stop   = (10 * Evaluate.MILIS);
            int  record = 0;

            INeuralDataPair pair = BasicNeuralDataPair.CreatePair(10, 10);

            Stopwatch watch = new Stopwatch();

            watch.Start();

            int iterations = 0;

            while (watch.ElapsedMilliseconds < stop)
            {
                iterations++;
                training2.GetRecord(record++, pair);
                if (record >= training2.Count)
                {
                    record = 0;
                }
            }

            training2.Close();

            iterations /= 100000;

            this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP4,
                               "Disk(binary) dataset, result: "
                               + Format.FormatInteger(iterations));

            File.Delete(file);
            this.binaryScore = iterations;
        }
Пример #5
0
        /// <summary>
        /// Move to the next element.
        /// </summary>
        /// <returns>True if there are more elements to read.</returns>
        public bool MoveNext()
        {
            try
            {
                if (this.current >= data.Count)
                {
                    return(false);
                }

                this.currentRecord = BasicNeuralDataPair.CreatePair(this.data
                                                                    .InputSize, this.data.IdealSize);
                this.data.GetRecord(this.current++, this.currentRecord);
                return(true);
            }
            catch (EndOfStreamException)
            {
                return(false);
            }
        }