在并行整洁的Python中保存最佳基因组
标题怎么说。我不知道如何在NEAT Python中选择适合度最好的基因组并将其保存到文件中,只有在配置中达到适合度目标时 对于目标赢家,我使用了一个通用的教程代码:在并行整洁的Python中保存最佳基因组,python,neat,Python,Neat,标题怎么说。我不知道如何在NEAT Python中选择适合度最好的基因组并将其保存到文件中,只有在配置中达到适合度目标时 对于目标赢家,我使用了一个通用的教程代码: if __name__ == "__main__": pe = neat.ParallelEvaluator(20, eval_genomes) winner = p.run(pe.evaluate, 20) with open('winner.pk1', 'wb') as output:
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)
看看这个。。如果你能试试的话
with open("Winner.pkl", "wb") as f:
pickle.dump(winner, f)
f.close()