public void Run() { if (_neuralNet == null) { return; } _neuralNet.Run(AddNoise(Trainigs[TestSample], TestNoise), _expectations[TestSample], out double[] outputs); Columns.SetColumns(outputs); }
public void Train() { _neuralNet = new NeuralNet(new int[] { Trainigs[0].Length, X, Y, 4 }, L, 0, 1, new Sigmoid(), new MeanSquare()); var noises = new double[2][][]; for (var j = 0; j < noises.Length; j++) { noises[j] = new double[Trainigs.Length][]; for (var k = 0; k < Trainigs.Length; k++) { noises[j][k] = AddNoise(Trainigs[k], LearnNoise); } } var learnErrors = new double[E]; var testErrors = new double[E]; for (var i = 0; i < E; i++) { testErrors[i] = 0; for (var j = 0; j < noises.Length; j++) { for (var k = 0; k < Trainigs.Length; k++) { testErrors[i] += _neuralNet.Run(noises[j][k], _expectations[k], out double[] outputs); } } testErrors[i] /= noises.Length * Trainigs.Length; learnErrors[i] = 0; for (var j = 0; j < Trainigs.Length; j++) { learnErrors[i] += _neuralNet.Train(Trainigs[j], _expectations[j]); } learnErrors[i] /= Trainigs.Length; } Lines.SetLines(learnErrors, testErrors); }