It seems that deepcopy is recursive and recursion is pretty bad. Currently each Neuron has a list of connected Neurons and those also have a list of connected neurons. It seems that deepcopy is reaching it's limit in this regard.
There seems to be a way to increase the limit but I would like to avoid it.
This means that we either implement our own copy method, in which we simply create a new neural network and then add individual neurons and connections piece by piece (that would probably be the simple solution) or we completely change the way connections between neurons are represented. For example, we could store the connections directly in the neural network instead of in the neuron and then sort the connections so that we can process them from top to bottom.
If we can minimize recursion by doing this, it could also improve performance.
It seems that deepcopy is recursive and recursion is pretty bad. Currently each Neuron has a list of connected Neurons and those also have a list of connected neurons. It seems that deepcopy is reaching it's limit in this regard.
There seems to be a way to increase the limit but I would like to avoid it.
https://stackoverflow.com/questions/3323001/what-is-the-maximum-recursion-depth-and-how-to-increase-it
This means that we either implement our own copy method, in which we simply create a new neural network and then add individual neurons and connections piece by piece (that would probably be the simple solution) or we completely change the way connections between neurons are represented. For example, we could store the connections directly in the neural network instead of in the neuron and then sort the connections so that we can process them from top to bottom.
If we can minimize recursion by doing this, it could also improve performance.