alenaksu / neatjs

NEAT (Neuro Evolution of Augmenting Topologies) implementation in JavaScript
https://alenaksu.github.io/neatjs/
GNU General Public License v3.0
22 stars 5 forks source link

Please document configuration #13

Closed dustinlacewell closed 3 years ago

dustinlacewell commented 3 years ago

Please document the various configuration variables and so on. I'm worried that the fitness values I'm using and other things don't make sense with the various settings but I don't know what they mean.

alenaksu commented 3 years ago

Hey @dustinlacewell, did you take a look at these comments already? https://github.com/alenaksu/neatjs/blob/master/src/types.ts#L23

dustinlacewell commented 3 years ago

I did find those, but they have very short descriptions without much context. It's hard to know what they are for. If you spent some time writing some helpful documentation this library's value would go up a lot. Not everyone will be an expert in all of NEAT's details or how NEAT is implemented in your library.

For example, in my simulation, each time a creature eats food, they get +1 fitness. But the default fitness threshold is .9... Does that mean I should be making the fitness much smaller?

alenaksu commented 3 years ago

I see your point, actually I created this project to learn NEAT, so I didn't expect other people would start using it, and more important, implementation might not be complete. But thanks for the feedback, I'll try to find some time to create a bit of documentation.

In the meanwhile, let's see if I can help...

The fitness threshold depends on how you compute the fitness. For example, if your fitness range from 0.0 to 1.0, then it makes sense to have a threshold that is less than and close to 1.0.

For example, take a look at the XOR experiment. In this experiment the way I compute the fitness would return a max value of 16, so I've set the threshold to 15.9.

Hope it helps, otherwise post some code and I'll take a look.

dustinlacewell commented 3 years ago

What if my fitness is unbounded, like in the case where creatures are collecting "food" for points in a randomly generated environment. I'll post code as soon as I can.

dustinlacewell commented 3 years ago

Also, neataptic is no longer maintained and has no typings. You're basically carrying the entire NEAT TypeScript community! All ~2 of us haha :D

alenaksu commented 3 years ago

What if my fitness is unbounded, like in the case where creatures are collecting "food" for points in a randomly generated environment. I'll post code as soon as I can.

Maybe you could divide the number of food collected by each creature by the sum of food available in the environment, so that you get a number between 0 and 1. For example:

Total food available: 30 Creature Food collected Fitness
A 3 0.1
B 15 0.5
C 7 0.23333

what do you think, does it make sense?

dustinlacewell commented 3 years ago

I did it and it worked :) https://react-ecs.ldlework.com/examples/three/EaterExample

alenaksu commented 3 years ago

Wow that's super cool, love the way the creatures evolve on each iteration :)

nice project by the way

dustinlacewell commented 3 years ago

Thanks.