CodeReclaimers / neat-python

Python implementation of the NEAT neuroevolution algorithm
BSD 3-Clause "New" or "Revised" License
1.4k stars 488 forks source link

Ability to load checkpoint with new configuration settings. #259

Open matthew-hre opened 1 year ago

matthew-hre commented 1 year ago

Currently, neat.Checkpointer.restore_checkpoint loads the checkpoint, along with the configuration used at the time. Would love to be able to load a checkpoint using an updated configuration file, to allow tweaking of factors such as fitness_threshold.

MikeUchmanowicz commented 1 year ago

I support this. I dont know how that would work or if its possible as I am a new user, but I think it could see some cool benefits.

luke-saunders commented 1 year ago

I'd looked into this last year. The following allows a new config to be defined when restoring a checkpoint. I've only briefly tested the change. It did appear to 'work', however, I'm unsure which new values take effect or if there are any adverse effects. I'd be keen to know how you go with it. https://github.com/luke-saunders/neat-python/tree/CheckpointNewConfig

neat/checkpoint.py def restore_checkpoint(filename, update_config=None): """Resumes the simulation from a previous saved point""" with gzip.open(filename) as f: generation, config, population, species_set, rndstate = pickle.load(f) random.setstate(rndstate) if update_config==None: return Population(config, (population, species_set, generation)) else: return Population(update_config, (population, species_set, generation))

On Sat, 15 Apr 2023 at 14:05, Michal A Uchmanowicz @.***> wrote:

I support this. I dont know how that would work or if its possible as I am a new user, but I think it could see some cool benefits.

— Reply to this email directly, view it on GitHub https://github.com/CodeReclaimers/neat-python/issues/259#issuecomment-1509492554, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLTFOJFFIWKJDEHB2AXG3DXBINAPANCNFSM6AAAAAAUQ26EHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>