CodeReclaimers / neat-python

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

Vectorization #239

Open TheMightiestCarrot opened 2 years ago

TheMightiestCarrot commented 2 years ago

Hello,

are there plans to vectorize FeedForwardNetwork.activate function? So activate function would accept matrix instead of an array.

Thanks.

CodeReclaimers commented 2 years ago

Probably not, at least not in the near term. I am working on an example with custom genes that generates a PyTorch network, so if that might be relevant for the situation you're thinking about, keep an eye out for that in the next week or two.

TheMightiestCarrot commented 2 years ago

maybe you will find this repo helpful: https://github.com/uber-research/PyTorch-NEAT

CodeReclaimers commented 2 years ago

Thanks! Hopefully, I can find time to incorporate some ideas from that project. I would like to support HyperNEAT and its variants if possible, or at least provide some tools to export neat-python networks into forms that can be evaluated in more high-performance tools/frameworks like PyTorch.

TheMightiestCarrot commented 2 years ago

also this bottleneck happens when trying to scale NEAT (1280 population on 128 cores), the GA operations seems to be slower than evalutation of fitness function (guess the GA operations are not parallelized), i dont know whether its even possible to solve that image the peaks are fitness evalutation

CodeReclaimers commented 2 years ago

This genome distance + speciation operation bottleneck has made me think more than once about ditching the "pure Python with no dependencies" rule I've stuck with so far. :)

I've made a note to take a stab at parallelizing the speciation.