CodeReclaimers / neat-python

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

How to make the output of neat to be only binary numbers? #199

Open ShinhuPark opened 4 years ago

ShinhuPark commented 4 years ago

I used Gym Retro to try NEAT in Pong Atari 2600.

The game has 2 binary numbers as input, but because the Neat gives me real numbers,

Instead of getting list of 0 or 1 like [0,1], it gives me 0.12451 or 123.3123. This cannot be input and i have no idea how to fix neat's output to only binary.

Is there any other way?

EKKOING commented 2 years ago

I think the best approach to this is to round the numbers to the nearest whole and then clamp that number to 0 or 1. NEAT will learn to place its outputs into that range of 0-1.