print(fitness) return fitness except Exception as e: print("error in evaluation") print(e) return [[-1],[-1]] # CONFIG try: theano.config.device = 'gpu' except: pass theano.config.floatX = 'float32' numpy.random.seed(0) training_data, validation_data, test_data = load_data(data_split=params["data_split"]) fns = { "generate": generate, "evaluate": evaluate, "evaluateBest": evaluateBest, "mutate": mutate, "crossover": crossover, "getFitness": getFitness } dump_file = "dump.obj" if len(sys.argv) > 1: if sys.argv[1] == "resume" and len(sys.argv) == 3: dump_file = sys.argv[2] ga = GAlg(ga_params, fns, dump_file)
# if ind["fitness"] is not None: # print(ind["fitness"][1][-1]), # print("") # print(len(generations)) # # print(len(generations)) # # for generation in generations: # # print(len(generation)) # CONFIG # try: theano.config.device = 'gpu' # except: pass theano.config.floatX = 'float32' numpy.random.seed(0) training_data, validation_data, test_data = load_data() fns = { "generate": generate, "evaluate": evaluate, "evaluateBest": evaluateBest, "mutate": mutate, "crossover": crossover, "getFitness": getFitness, "processData": processData } dump_file = "dump.obj" if len(sys.argv) > 1: if sys.argv[1] == "resume" and len(sys.argv) == 3: dump_file = sys.argv[2] elif len(sys.argv) == 2: