View Code? Open in Web Editor
NEW
This project forked from suckgeun/neat
Implementation of NeuroEvolution of Augmenting Topologies (NEAT)
neat-suckgeun's Introduction
Overall Work Flow
preparation
- create 100 neural networks with 50 inputs and 10 outputs; no hidden layer
- create speciation records (currently just one; initial species with no hidden layer)
test neural networks
- feed forward, get result
analyze results
- evaluate fitness of each neural networks with the results
(use modified fitness function such that no one species overwhelm the entire population)
- rank neural network in each group
- drop 50% of lesser neural networks from each species.
get next generation
- from each reduced species, first, mutate (check if mutation or crossover is first)
- then crossover
- global innovation number, connection mutation, node mutation, weight mutation
- E, D, how to crossover
- inter species crossover?
speciation
- speciate the neural networks using the "compatibility distance" function
- choose one genome from "previous" generation
- compare that to current generation
- if compatibility threshold satisfies, assign to the species
- if no species exists, create a new species
repeat the process
- go back to "test neural networks"
Details
Feed forward
- define function
- set it as main function to neural network using getattr
- calculate the inputs then output it.
- feed forward
- get result
initializing Neural Networks, History, and innovation counter
- create initial connect gene for one neural network using workplace info
- when creating, increment history and counter
- assign value to nns, history, and counter
Adding new connection
- Add_connect(in, out)
- does connection exists in global history?
- Is valid connection?
- is in-in connection?
- is out-out connection?
- is recursive connection?
- does nn have it?
- is it in global history?
- If all the above are not true,
- increment global innovation counter
- add the connection info to individual history