# evaluated the last individual in the generatio? write stats if (ea.actualOne() == (popsize-1)): print 'check: '+repr(ea.generation()) fit = ea.getBestInd().getFitness().get(); er = ea.getBestInd().getFitness().getError(); print '%d %.5f %.5f\n' % (ea.generation(),fit,er) f.write('%d %.8f %.8f\n' % (ea.generation(),fit,er)) f.flush() os.fsync(f.fileno()) # just write it to disk # poc++ and check end of ea ea.nextIndividual(); f.close() # load the best one found ind = ea.getIndNo(ea.getBest()); net = buildExperiment(ind); print 'best fitness is:' print ind.getFitness().get(); print 'build done \n\n'
ind.getFitness().setError(error) print 'Ind: ' + repr( ea.actualOne()) + ' Error is: ' + repr(error) + ' fitness is: ' + repr( ind.getFitness().get()) # print ea.getActualWeights(); # evaluated the last individual in the generatio? write stats if (ea.actualOne() == (popsize - 1)): print 'check: ' + repr(ea.generation()) fit = ea.getBestInd().getFitness().get() er = ea.getBestInd().getFitness().getError() print '%d %.5f %.5f\n' % (ea.generation(), fit, er) f.write('%d %.8f %.8f\n' % (ea.generation(), fit, er)) f.flush() os.fsync(f.fileno()) # just write it to disk # poc++ and check end of ea ea.nextIndividual() f.close() # load the best one found ind = ea.getIndNo(ea.getBest()) net = buildExperiment(ind) print 'best fitness is:' print ind.getFitness().get() print 'build done \n\n'