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 = getOutputLayer()
						.errorVectorFrom(nne.getTarget());
				processError(error);
			}
		}

	}
Esempio n. 2
0
 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);
         }
     }
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 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;
 }