Example #1
0
        /// <summary>
        /// First pass, count everything, establish min/max.
        /// </summary>
        private void FirstPass(bool headers)
        {
            OpenCSV(headers);
            OpenDataSet();

            _currentIndex = -1;
            _recordCount  = 0;

            if (_report != null)
            {
                _report.Report(0, 0, "Analyzing file");
            }
            _lastReport = 0;
            int index = 0;

            InitForPass();

            // loop over all of the records
            while (Next())
            {
                DetermineInputFieldValues(index, headers);

                if (ShouldInclude())
                {
                    ApplyMinMax();
                    _recordCount++;
                    ReportResult("First pass, analyzing file", 0, _recordCount);
                }
                index++;
            }
        }
Example #2
0
        /// <summary>
        /// Convert an external file format, such as CSV, to the Encog binary
        /// training format.
        /// </summary>
        /// <param name="binaryFile">The binary file to create.</param>
        public void External2Binary(String binaryFile)
        {
            Status.Report(0, 0, "Importing to binary file: "
                          + binaryFile);

            EncogEGBFile egb = new EncogEGBFile(binaryFile);

            egb.Create(codec.InputSize, codec.IdealSize);

            double[] input = new double[this.codec.InputSize];
            double[] ideal = new double[this.codec.IdealSize];

            this.codec.PrepareRead();

            int index         = 3;
            int currentRecord = 0;
            int lastUpdate    = 0;

            while (codec.Read(input, ideal))
            {
                egb.Write(input);
                egb.Write(ideal);

                index += input.Length;
                index += ideal.Length;
                currentRecord++;
                lastUpdate++;
                if (lastUpdate >= 10000)
                {
                    lastUpdate = 0;
                    this.Status.Report(0, currentRecord, "Importing...");
                }
            }

            egb.Close();
            this.codec.Close();
            Status.Report(0, 0, "Done importing to binary file: "
                          + binaryFile);
        }
Example #3
0
        /// <summary>
        /// Perform the benchmark. Returns the total amount of time for all of the
        /// benchmarks. Returns the final score. The lower the better for a score.
        /// </summary>
        /// <returns>The total time, which is the final Encog benchmark score.</returns>
        public String Process()
        {
            _report.Report(Steps, 0, "Beginning benchmark");

            EvalCpu();
            EvalMemory();
            EvalBinary();

            var result = new StringBuilder();

            result.Append("Encog Benchmark: CPU:");
            result.Append(Format.FormatInteger(_cpuScore));

            result.Append(", Memory:");
            result.Append(Format.FormatInteger(_memoryScore));
            result.Append(", Disk:");
            result.Append(Format.FormatInteger(_binaryScore));
            _report.Report(Steps, Steps, result.ToString());

            return(result.ToString());
        }
Example #4
0
 /// <summary>
 /// Recieve status reports.
 /// </summary>
 /// <param name="context">The context for this job.</param>
 /// <param name="status">The current status for this job.</param>
 public void ReportStatus(JobUnitContext context, String status)
 {
     _report.Report(_totalTasks, context.TaskNumber, status, 0.0, 0.0);
 }
 /// <summary>
 ///     Report that we are done. Used internally.
 /// </summary>
 /// <param name="isAnalyzing">True if we are analyzing.</param>
 public void ReportDone(bool isAnalyzing)
 {
     _report.Report(_recordCount, _recordCount,
                    isAnalyzing ? "Done analyzing" : "Done processing");
 }