1

I'm working on making my own neural network using the NEAT algorithm. I have programmed the algorithm from scratch because I can't seem to get any of the libraries online working, but I'm 90% sure the actual algorithm for genetic breeding is working.

My issue is the creating of a fitness function because none of the ones I have tried to use seemed to have worked. All I'm trying to make is a simple XOR gate with two inputs and one output. I have tried something as basic as testing all the possible inputs ($[0,0], [0,1],$ etc.) and determine how close they are to the resultant by using a function similar to $(x^2-1)/(x^2+1)$, and then for each one of the different inputs add the result of the function to the fitness. That didn't seem to work well.

I can't seem to find any information online on the best methods for creating a fitness function, so I wasn't sure if there is some sort of guideline/equation to follow. Any information will help. Thank you.

MagnusCaligo
  • 121
  • 3

1 Answers1

2

There are two parts of your question which give me pause.

I have programmed the algorithm from scratch because I can't seem to get any of the libraries online working, but I'm 90% sure the actual algorithm for genetic breeding is working.

This makes me worry that there is a bug somewhere in your code. Do you have unit tests? Have you verified that your code works as expected on a toy example?

My issue is the creating of a fitness function because none of the ones I have tried to use seemed to have worked.

If the core functionality of your code is broken, I would expect that none of the fitness functions would work.

Sycorax
  • 76,417
  • 20
  • 189
  • 313