public void TrainOn(NNDataSet innds, int numberofEpochs) { for (int i = 0; i < numberofEpochs; i++) { innds.RefreshDataset(); while (innds.HasMoreExamples()) { NNExample nne = innds.GetExampleAtRandom(); this.ProcessInput(nne.GetInput()); Vector error = layer.ErrorVectorFrom(nne.GetTarget()); this.ProcessError(error); } } }
public int[] TestOnDataSet(NNDataSet nnds) { int[] result = new int[] { 0, 0 }; nnds.RefreshDataset(); while (nnds.HasMoreExamples()) { NNExample nne = nnds.GetExampleAtRandom(); Vector prediction = this.Predict(nne); if (nne.IsCorrect(prediction)) { result[0] = result[0] + 1; } else { result[1] = result[1] + 1; } } return(result); }