errorClosure, elitism=elitism, populationSize=populationSize, mutationProbability=mutationProbability, mutationScale=mutationScale, numIterations=numIterations, errorTreshold=errorTreshold, alpha=alpha) print_every = 100 # Print the output every this many iterations plot_every = 10000 # Plot the actual vs estimated functions every this many iterations # emulated do-while loop done = False while not done: done, iteration, best = GA.step() if iteration % print_every == 0: print "Error at iteration %d = %f" % (iteration, errorClosure(best)) if iteration % plot_every == 0: NN.setWeights(best) plotter.plot(X_train, y_train, NN.output(X_train)) plotter.plot_surface(X_train, y_train, NN) print "Training done, running on test set" NN.setWeights(best) print "Error on test set: ", NN.forwardStep(X_test, y_test) plotter.plot(X_test, y_test, NN.output(X_test)) plotter.plot_surface(X_test, y_test, NN)
elitism = elitism, populationSize = populationSize, mutationProbability = mutationProbability, mutationScale = mutationScale, numIterations = numIterations, errorTreshold = errorTreshold) print_every = 100 # Print the output every this many iterations plot_every = 100 # Plot the actual vs estimated functions every this many iterations # emulated do-while loop done = False while not done: done, iteration, best = GA.step() if iteration % print_every == 0: print "Error at iteration %d = %f" % (iteration, errorClosure(best)) if iteration % plot_every == 0: NN.setWeights(best) plotter.plot(X_train, y_train, NN.output(X_train)) plotter.plot_surface(X_train, y_train, NN) print "Training done, running on test set" NN.setWeights(best) print "Error on test set: ", NN.forwardStep(X_test, y_test) plotter.plot(X_test, y_test, NN.output(X_test)) plotter.plot_surface(X_test, y_test, NN)