Johnny Lunder
Johnny Lunder

Reputation: 11

Save best genome in a parallel NEAT-Python

What title says. I can't figure out how to pick the genome with best fitness in NEAT-Python and save it to a file, only when one hits the fitness goal in the config.

For the goal winner, I'm using a common tutorial code :

if __name__ == "__main__":
    pe = neat.ParallelEvaluator(20, eval_genomes)
    winner = p.run(pe.evaluate, 20)
    with open('winner.pk1', 'wb') as output:
        pickle.dump(winner, output, 1)

Upvotes: 1

Views: 815

Answers (1)

Angelo
Angelo

Reputation: 19

look at this.. if you can try

with open("Winner.pkl", "wb") as f:
    pickle.dump(winner, f)
    f.close()

Upvotes: 1

Related Questions