public static Generate ( long seed, int count, int inputCount, int idealCount, double min, double max ) : BasicMLDataSet | ||
seed | long | The seed value to use, the same seed value will always produce /// the same results. |
count | int | How many training items to generate. |
inputCount | int | How many input numbers. |
idealCount | int | How many ideal numbers. |
min | double | The minimum random number. |
max | double | The maximum random number. |
return | BasicMLDataSet |
/// <summary> /// Evaluate memory. /// </summary> private void EvalMemory() { BasicMLDataSet training = RandomTrainingFactory.Generate( 1000, 10000, 10, 10, -1, 1); const long stop = (10 * Evaluate.Milis); int record = 0; IMLDataPair pair; int iterations = 0; var watch = new Stopwatch(); watch.Start(); while (true) { iterations++; pair = training[record++]; if (record >= training.Count) { record = 0; } if ((iterations & 0xff) == 0 && watch.ElapsedMilliseconds >= stop) { break; } } iterations /= 100000; _report.Report(Steps, Step2, "Memory dataset, result: " + Format.FormatInteger(iterations)); _memoryScore = iterations; }
/// <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; }
/// <summary> /// Evaluate disk. /// </summary> private void EvalBinary() { FileInfo file = FileUtil.CombinePath(new FileInfo(Path.GetTempPath()), "temp.egb"); BasicMLDataSet training = RandomTrainingFactory.Generate( 1000, 10000, 10, 10, -1, 1); // create the binary file if (file.Exists) { file.Delete(); } var training2 = new BufferedMLDataSet(file.ToString()); training2.Load(training); const long stop = (10 * Evaluate.Milis); int record = 0; IMLDataPair pair; var watch = new Stopwatch(); watch.Start(); int iterations = 0; while (true) { iterations++; pair = training[record++]; if (record >= training.Count) { record = 0; } if ((iterations & 0xff) == 0 && watch.ElapsedMilliseconds >= stop) { break; } } training2.Close(); iterations /= 100000; _report.Report(Steps, Step3, "Disk(binary) dataset, result: " + Format.FormatInteger(iterations)); if (file.Exists) { file.Delete(); } _binaryScore = iterations; }
/// <summary> /// Evaluate training. /// </summary> /// <param name="input">Input neurons.</param> /// <param name="hidden1">Hidden 1 neurons.</param> /// <param name="hidden2">Hidden 2 neurons.</param> /// <param name="output">Output neurons.</param> /// <returns>The result of the evaluation.</returns> public static int EvaluateTrain(int input, int hidden1, int hidden2, int output) { BasicNetwork network = EncogUtility.SimpleFeedForward(input, hidden1, hidden2, output, true); IMLDataSet training = RandomTrainingFactory.Generate(1000, 10000, input, output, -1, 1); return(EvaluateTrain(network, training)); }
/// <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; }
/// <summary> /// Evaluate training, use OpenCL. /// </summary> /// <param name="device">The OpenCL device, null for CPU.</param> /// <param name="input">Input neurons.</param> /// <param name="hidden1">Hidden 1 neurons.</param> /// <param name="hidden2">Hidden 2 neurons.</param> /// <param name="output">Output neurons.</param> /// <returns>The result of the evaluation.</returns> public static int EvaluateTrain(EncogCLDevice device, int input, int hidden1, int hidden2, int output) { BasicNetwork network = EncogUtility.SimpleFeedForward(input, hidden1, hidden2, output, true); INeuralDataSet training = RandomTrainingFactory.Generate(1000, 10000, input, output, -1, 1); OpenCLTrainingProfile profile = null; #if !SILVERLIGHT if (device != null) { profile = new OpenCLTrainingProfile(device); } #endif return(EvaluateTrain(profile, network, training)); }