public void GetErrorTest() { IBackPropagation target = CreateIBackPropagation(); // TODO: Initialize to an appropriate value double expected = 0F; // TODO: Initialize to an appropriate value double actual; actual = target.GetError(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public bool Train() { double currentError = 0; int currentIteration = 0; NeuralEventArgs Args = new NeuralEventArgs(); do { currentError = 0; foreach (KeyValuePair <T, double[]> p in TrainingSet) { NeuralNet.ForwardPropagate(p.Value, p.Key); NeuralNet.BackPropagate(); currentError += NeuralNet.GetError(); } currentIteration++; if (IterationChanged != null && currentIteration % 5 == 0) { Args.CurrentError = currentError; Args.CurrentIteration = currentIteration; IterationChanged(this, Args); } } while (currentError > maximumError && currentIteration < maximumIteration && !Args.Stop); if (IterationChanged != null) { Args.CurrentError = currentError; Args.CurrentIteration = currentIteration; IterationChanged(this, Args); } if (currentIteration >= maximumIteration || Args.Stop) { return(false); } return(true); }
public bool Train() { double currentError = 0; int currentIteration = 0; NeuralEventArgs Args = new NeuralEventArgs(); do { currentError = 0; foreach (FaceImage face in _trainingSet) { _neuralNet.ForwardPropagate(face.VectorInNet, face.PersonId); _neuralNet.BackPropagate(); currentError += _neuralNet.GetError(); } currentIteration++; if (IterationChanged != null && currentIteration % 5 == 0) { Args.CurrentError = currentError; Args.CurrentIteration = currentIteration; IterationChanged(this, Args); } } while (currentError > _maxError && currentIteration < _maxIter && !Args.Stop); if (IterationChanged != null) { Args.CurrentError = currentError; Args.CurrentIteration = currentIteration; IterationChanged(this, Args); } if (currentIteration >= _maxIter || Args.Stop) { return(false);//Training Not Successful } return(true); }
public bool Train() { double currentError = 0; int currentIteration = 0; NeuralEventArgs Args = new NeuralEventArgs(); do { currentError = 0; Random r = new Random(); foreach (KeyValuePair <string, double[]> pattern in _distractionTrainingSet.OrderBy(x => r.Next())) { _neuralNet.ForwardPropagate(pattern.Value, pattern.Key[0].ToString()); _neuralNet.BackPropagate(); currentError += _neuralNet.GetError(); } currentIteration++; if (currentIteration % 5 == 0) { ViewModel.CurrentError = currentError; ViewModel.CurrentIteration = currentIteration; } if (currentIteration % 10 == 0) { List <string> toRemoved = new List <string>(); bool isOver = true; foreach (var samplePattern in _settingsModel.SampleTrainingSet) { Recognize(samplePattern.Value, _recognizeModel); if (samplePattern.Key[0].Equals(_recognizeModel.MatchedHigh[0]) && _recognizeModel.OutputHightValue >= 0.1) { toRemoved.Add(samplePattern.Key); // _trainingSet.Remove(samplePattern.Key); } else { // currentError = 0.1; isOver = false; //isOver = true; } } if (isOver) { foreach (var patternToremove in toRemoved) { _settingsModel.SampleTrainingSet.Remove(patternToremove); } } } } while (currentError > ViewModel.MaximumError && currentIteration < MaximumIteration); if (Math.Abs(currentError) < 0.001 && currentIteration != 0) { ViewModel.CurrentError = currentError; ViewModel.CurrentIteration = currentIteration; } if (currentIteration >= MaximumIteration) { return(false);//Training Not Successful } return(true); }