def test_it_without_bp(): pop, stats = main() stringh = "_without_bp" fronts = tools.sortNondominated(pop, len(pop)) if len(fronts[0]) < 30: pareto_front = fronts[0] else: pareto_front = random.sample(fronts[0], 30) print("Pareto Front: ") for i in range(len(pareto_front)): print(pareto_front[i].fitness.values) neter = Neterr(indim, outdim, n_hidden, random) print("\ntest: test on one with min validation error", neter.test_err(min(pop, key=lambda x: x.fitness.values[1]))) tup = neter.test_on_pareto_patch(pareto_front) print("\n test: avg on sampled pareto set", tup[0], "least found avg", tup[1]) st = str(neter.test_err(min( pop, key=lambda x: x.fitness.values[1]))) + " " + str( tup[0]) + " " + str(tup[1]) print(note_this_string(st, stringh))
def test_it_with_bp(play=1, NGEN=100, MU=4 * 25): pop, stats = main(play=play, NGEN=NGEN, MU=MU) stringh = "_with_bp_without_clustring" + str(play) + "_" + str(NGEN) fronts = tools.sortNondominated(pop, len(pop)) if len(fronts[0]) < 30: pareto_front = fronts[0] else: pareto_front = random.sample(fronts[0], 30) print("Pareto Front: ") for i in range(len(pareto_front)): print(pareto_front[i].fitness.values) neter = Neterr(indim, outdim, n_hidden, random) print("\ntest: test on one with min validation error", neter.test_err(min(pop, key=lambda x: x.fitness.values[1]))) tup = neter.test_on_pareto_patch_correctone(pareto_front) print("\n test: avg on sampled pareto set", tup) st = str(neter.test_err(min( pop, key=lambda x: x.fitness.values[1]))) + " " + str(tup) print( note_this_string(st, stringh) ) ##################################################################################