google / brain-tokyo-workshop

🧠🗼

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why parameter ‘prob_crossover’ is 0?

jinglinglingling opened this issue · comments

Hi,
I know that neat algorithm needs to crossover in the evolution. Does WANN abandon this point and only make the mutation?

Thanks

Hey,

this is largely due to how NEAT defines crossover:

Matching genes are inherited randomly, whereas disjoint genes (those that do not match in the middle) and excess genes (those that do not match in the end) are inherited from the more fit parent.

From "Evolving Neural Networks through Augmenting Topologies"

In the implementation (of this repository) it is stated a bit more clear: Take all genes from the more fit parent. With some chance take some of the weights of the less fit parents for those genes that match up. Since WANNs don't use weights, this version of crossover becomes pretty much meaningless.

I was honestly suprised by this as well. Deprecation of crossover is neither mentioned in the paper nor on the github-website. It would certainly be interesting to see whether crossover can take on a different shape in the context of WANNs.

TL;DR: Crossover in NEAT just affects the weights.

Hey,

this is largely due to how NEAT defines crossover:

Matching genes are inherited randomly, whereas disjoint genes (those that do not match in the middle) and excess genes (those that do not match in the end) are inherited from the more fit parent.

From "Evolving Neural Networks through Augmenting Topologies"

In the implementation (of this repository) it is stated a bit more clear: Take all genes from the more fit parent. With some chance take some of the weights of the less fit parents for those genes that match up. Since WANNs don't use weights, this version of crossover becomes pretty much meaningless.

I was honestly suprised by this as well. Deprecation of crossover is neither mentioned in the paper nor on the github-website. It would certainly be interesting to see whether crossover can take on a different shape in the context of WANNs.

TL;DR: Crossover in NEAT just affects the weights.

Thanks for you reply!
But in this Fig(from NEAT), the child tree change the structure through the parent's Innovation ID.
Is that a Crossover?
4-1-5

commented

Hey guys, when we made WANNs NEAT was our starting point, but we simplified it greatly, cutting out speciation and crossover.

The motivation was not that we thought it would necessarily work better without crossover and speciation but that to communicate the main point that we could encode the solutions entirely in the structure. NEAT has a lot of moving parts, and as we were presenting this to an ML audience not an EA audience, we thought the cleaner we could make the implementation the better.

So rather than having to explain crossover in the paper, we cut it. Rather than having to explain compatibility distance and fitness sharing, we cut it.

But is all still in there. You can run start using crossover and speciation just by changing some hyperparameters. It worked without, but we didn't do any thorough testing to see if it would have worked better with. My intuition is that crossover will not be that beneficial, there are no weights to average and so it will just add structure --- in the WANN case we are trying to find less complex solutions, so this might be a cross purposes. If you do start using crossover remember that crossover takes place only within species. The way things are set up right now we are only using multi-objective optimization and no species, or rather all are in the same species. This will end up in a lot of bloat. Be sure to use species if you are using crossover.

If you are playing around and find something interesting don't hesitate to let us know!

But in this Fig(from NEAT), the child tree change the structure through the parent's Innovation ID.
Is that a Crossover?

Ah, interesting - the paper states:

In composing the offspring, genes are randomly chosen from either parent at matching genes,whereas all excess or disjoint genes are always included from the more fit parent.

Only in the caption of figure 4 does it add:

In this case, equal fitnesses are assumed, so the disjoint and excess genes are also inherited randomly.

Pretty, weird that they base their image on an edge case...

@agaier It won't even add structure, though, since due to the way crossover is implemented in this repository, all genes are always inherited from the more fit parent (and it is assumend that there won't be equally fit parents) - only the weights might be inherited from the less fit parent (the relevant implementations can be found here (WANN) and here (prettyNEAT) - prettyNeatWann does not contain any crossover function). Or am I missing something here?

Regarding speciation: You still use speciation to determine the number of offspring for each species, though, right?

@jinglinglingling If you want to test crossover on WANNs, it might be worth looking at other NEAT implementations and see if they also structurally crossover the two parents.