joeddav / devol

Genetic neural architecture search with Keras

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mutate Rate

heitorrapela opened this issue · comments

First of all, nice work @joeddav . I would like to know if you could explain the mutate function over genome_handler.py. Because I would like to set mutate rate like in population from crossover (95%) and best models survive rates (95%).

To change the crossover vs. persistence rate, you can just change the .95 on lines 137 and 141 in devol.py. Make sure they're the same number. A PR making this a parameter would be welcome :)

Take a look at line 240 of devol.py in _mutate to change the mutation rate.

If you make the changes locally and installed with pip install -e, your changes should be usable in your python environment immediately.

Thanks for the answer, i understand and already had changed the lines 137 and 141.
But what is the meaning of line 240 in terms of rate: num_mutations = max(3, generation // 4)?

Right, that line is a bit confusing. The idea is that GAs often do better when you increase the number of mutations in later generations. Our ad hoc implementation was to divide the generation number by 4, and then take the max of that and 3. So up to the 16th generation, 3 mutations occur to every genome. After that, it increases every 4 generations.