How to log the best individual in each generation

73 views
Skip to first unread message

Pascal Rochon

unread,
Mar 25, 2014, 8:36:31 AM3/25/14
to deap-...@googlegroups.com
Hi, 

I work with cma-es algorithm (same as cma_minfct.py example). 

In the algorithm "eagenerateupdate" I need to write a log file at each generation with the best individual, do you have an idea how to do this?
Now I use the same output as the example file.

thank you
Pascal





François-Michel De Rainville

unread,
Mar 25, 2014, 1:53:25 PM3/25/14
to deap-...@googlegroups.com
Actually, there is no way to do this outside of the algorithm with the current version. You could copy the content of eaGenerateUpdate in your main function and modify it directly to add the best individual in the logbook. This is what I've done here https://gist.github.com/fmder/9767038. Note that the best individual won't be printed on screen however they are returned in a Logbook wich offers a very useful "select" method to retreive specific data of the whole evolution.

gens, bests = logbook.select("gen", "best")

I will add a feature request in the issues (on googlecode) to add a persistency feature in the hall of fame.


--
You received this message because you are subscribed to the Google Groups "deap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages