99100101102103104105106107108109
private int trainNeuralNetwork() { final Train train = new ResilientPropagation(network, trainingData); int epoch = 1; do { train.iteration(); //System.out.println("Epoch #" + epoch + " Error: " + train.getError()); epoch++; if (epoch > 500) { return 1; }
5051525354555657585960
ResilientPropagation rprop2 = new ResilientPropagation(net2,trainingSet); rprop1.iteration(); rprop1.iteration(); rprop2.iteration(); rprop2.iteration(); TrainingContinuation cont = rprop2.pause(); ResilientPropagation rprop3 = new ResilientPropagation(net2,trainingSet);
5152535455565758596061
rprop1.iteration(); rprop1.iteration(); rprop2.iteration(); rprop2.iteration(); TrainingContinuation cont = rprop2.pause(); ResilientPropagation rprop3 = new ResilientPropagation(net2,trainingSet); rprop3.resume(cont);
5960616263646566676869
ResilientPropagation rprop3 = new ResilientPropagation(net2,trainingSet); rprop3.resume(cont); rprop1.iteration(); rprop3.iteration(); for(int i=0;i<net1.getFlat().getWeights().length;i++) { Assert.assertEquals(net1.getFlat().getWeights()[i], net2.getFlat().getWeights()[i],0.0001); }
7879808182838485868788
ResilientPropagation rprop2 = new ResilientPropagation(net2,trainingSet); rprop1.iteration(); rprop1.iteration(); rprop2.iteration(); rprop2.iteration(); TrainingContinuation cont = rprop2.pause(); EncogDirectoryPersistence.saveObject(EG_FILENAME, cont);
7980818283848586878889
rprop1.iteration(); rprop1.iteration(); rprop2.iteration(); rprop2.iteration(); TrainingContinuation cont = rprop2.pause(); EncogDirectoryPersistence.saveObject(EG_FILENAME, cont); TrainingContinuation cont2 = (TrainingContinuation)EncogDirectoryPersistence.loadObject(EG_FILENAME);
90919293949596979899100
ResilientPropagation rprop3 = new ResilientPropagation(net2,trainingSet); rprop3.resume(cont2); rprop1.iteration(); rprop3.iteration(); for(int i=0;i<net1.getFlat().getWeights().length;i++) { Assert.assertEquals(net1.getFlat().getWeights()[i], net2.getFlat().getWeights()[i],0.0001); }
430431432433434435436437438439440
train.addStrategy(strat); train.setNumThreads(1); // force single thread mode for (int i = 0; (i < this.iterations) && !getShouldStop() && !strat.shouldStop(); i++) { train.iteration(); } error = Math.min(error, train.getError()); }
4950515253545556575859
train.setRPROPType(RPROPType.iRPROPp); int epoch = 1; do { train.iteration(); epoch++; } while (train.getError() > 0.01 && epoch<1000 ); if( epoch>900 ) { failureCount++;
139140141142143144145146147148149
final MLTrain train = new ResilientPropagation(network, training); int epoch = 1; do { train.iteration(); System.out .println("Epoch #" + epoch + " Error:" + train.getError()); epoch++; } while(train.getError() > MAX_ERROR); }