Exemple #1
0
        /// <summary>
        /// Convert a CSV file to a binary training file.
        /// </summary>
        /// <param name="csvFile">The CSV file.</param>
        /// <param name="binFile">The binary file.</param>
        /// <param name="inputCount">The number of input values.</param>
        /// <param name="outputCount">The number of output values.</param>
        /// <param name="headers">True, if there are headers on the3 CSV.</param>
        public static void ConvertCSV2Binary(String csvFile,
                                             String binFile, int inputCount, int outputCount,
                                             bool headers)
        {
            File.Delete(binFile);
            CSVNeuralDataSet csv = new CSVNeuralDataSet(csvFile.ToString(),
                                                        inputCount, outputCount, false);
            BufferedNeuralDataSet buffer = new BufferedNeuralDataSet(binFile);

            buffer.BeginLoad(50, 6);
            foreach (INeuralDataPair pair in csv)
            {
                buffer.Add(pair);
            }
            buffer.EndLoad();
        }
Exemple #2
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;
        }