SirBob01 / NEAT-Python

Genetic learning algorithm implementation for simulations, games, or general machine learning problems
BSD 3-Clause "New" or "Revised" License
47 stars 10 forks source link

Code refactoring #1

Open SirBob01 opened 4 years ago

SirBob01 commented 4 years ago

Refactor the code to make it more elegant and optimized (especially for the core algorithm).

foster999 commented 4 years ago

Would it be useful for me to replace some of the for loops with numpy matrix-based calculations?

Love the project by the way!

SirBob01 commented 4 years ago

Hi @foster999! Thank you for the comment! Yes, it would be nice to finally migrate to numpy. I initially wrote this from scratch to test my understanding of neural networks. But for maintainability's sake, perhaps this would be much better haha!

foster999 commented 4 years ago

Excellent @SirBob01, I'll give it a go then! Hoping that working through the code will improve my understanding of them too 😄

SirBob01 commented 4 years ago

Hm, I've given this some thought. I don't think it would be possible to use matrix-based calculations for this particular algorithm.

The whole idea is that the nodes are topologically free and can be disabled, shifted, and connected to other nodes randomly. The networks are likely always going to be asymmetric, so I don't know how we could represent them with matrices.