/* * Gets (and removes) a random example from the 'presentlyProcessed' */ public NNExample getExample(int index) { NNExample result = presentlyProcessed[index]; presentlyProcessed.RemoveAt(index); return(result); }
/* * Gets (and removes) a random example from the 'presentlyProcessed' */ public NNExample getExampleAtRandom() { int i = Util.randomNumberBetween(0, (presentlyProcessed.Count - 1)); NNExample result = presentlyProcessed[i]; presentlyProcessed.RemoveAt(i); return(result); }
public void trainOn(NNDataSet innds, int numberofEpochs) { for (int i = 0; i < numberofEpochs; i++) { innds.refreshDataset(); while (innds.hasMoreExamples()) { NNExample nne = innds.getExampleAtRandom(); processInput(nne.getInput()); Vector error = layer.errorVectorFrom(nne.getTarget()); processError(error); } } }
public int[] testOnDataSet(NNDataSet nnds) { int[] result = new int[] { 0, 0 }; nnds.refreshDataset(); while (nnds.hasMoreExamples()) { NNExample nne = nnds.getExampleAtRandom(); Vector prediction = predict(nne); if (nne.isCorrect(prediction)) { result[0] = result[0] + 1; } else { result[1] = result[1] + 1; } } return(result); }
public Vector predict(NNExample nne) { return(processInput(nne.getInput())); }
public Vector predict(NNExample nne) { return processInput(nne.getInput()); }