janhohenheim / Hippocrates

No longer maintained, actually usable implementation of NEAT
GNU Affero General Public License v3.0
62 stars 12 forks source link

Online training whole generation at a time? #91

Closed jpfeltracco closed 7 years ago

jpfeltracco commented 7 years ago

Feel free to close if you all don't want question-based issues!

I need a NEAT implementation that allows me to evaluate a whole generation at once. Essentially the fitness of each individual in a generation will be based on a simulation involving all of the individuals. So for each generation I need to:

  1. Get a list of neural networks
  2. Run the simulation with the neural networks
  3. Set the fitness of each network/genome based on the results of the simulation
  4. Create the new generation

I've been browsing through a bit of the example code but haven't seen anything like this. Would the architecture be able to support this or am I doing something crazy?

Thanks!

Mafii commented 7 years ago

Hello. No, not at all crazy! We have implemented the serialization of all data our NEAT-implementation holds some time ago. I think you should be able to easely read the fitness of the networks out of that.

However, I'll assign @SirRade and @STJEREM since they did the concrete implementation. If you have anything to discuss about feel free to hop onto our Gitter for that purpose.

jeremystucki commented 7 years ago

This sounds like a very cool idea.

We have not yet implemented such a training method. Although I will discuss this with @SirRade. I'm sure we will add such functionality in the near future.

janhohenheim commented 7 years ago

I suspect our UnsupervisedTraining method is exactly what you want, however it is still very much undocumented and has no example code. I will write an example as soon as possible if you plan on using it.

Get a list of neural networks Run the simulation with the neural networks

Is it ok if you get the network outputs for each individual, one after another?

Set the fitness of each network/genome based on the results of the simulation

Do you want to set the fitness continuously or once at the end of the generation?

janhohenheim commented 7 years ago

Turns out I have to modify the implementation a little bit. This will be implemented later this day

jpfeltracco commented 7 years ago

Awesome! Thanks for looking into it!

To answer your questions:

Is it ok if you get the network outputs for each individual, one after another? I think so, I just need to be able to set the inputs and get the corresponding outputs for each individual multiple times during the simulation (once per frame of the simulation).

Do you want to set the fitness continuously or once at the end of the generation? I won't really know the fitness of each individual until a full simulation is finished, so I believe just once at the end of the generation.

janhohenheim commented 7 years ago

Implemented with #92.
Hippocrates is now fully able to do what you need.
I will later write a tutorial/documentation on how to use the API for unsupervised learning

janhohenheim commented 7 years ago

In case you have any questions, I kindly invite you to ask us anything you want on our gitter.

The library has still not been tested by a large audience.
We would be happy for your feedback and suggestions of improvement :)