CodeReclaimers / neat-python

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

Hidden nodes raise genetic distance #221

Open regtm opened 3 years ago

regtm commented 3 years ago

When initiating networks with hidden nodes, compatibility_weight_coefficient set to zero and all structural mutation rates set to zero the first generation still has a genetic distance that is greater than zero. Am I missing something here? I'd expect all initialized genomes to be identical when no structural mutations are present.

zedwei commented 3 years ago

I'm facing a similar issue. I guess there are two things which may cause this

  1. Due to "connection_fraction", a fraction of the full connections were created randomly, which can cause graph structure difference. See the function here. This is expected I think.
  2. The current implementation creates nodes with new IDs for hidden layers during each genome initialization, instead of re-using the IDs. Refer to this code. This would cause disjoint_nodes which increases the genome distance. I'm still new to NEAT so don't know if this is the correct behavior, as the original NEAT paper suggests to start with NO hidden layer anyway... I hope someone with more experience could comment on this. Thanks!