-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Genome.dna
from List[int] to numpy.ndarray
#158
Comments
i think as we make this change we can also change from a one-dimensional representation with our custom access functions to a three-dimensional structure with (rows, cols, genes) dimensions. i think this would simplify the implementation significantly. however, we'd need to think a bit about how to treat input/output nodes as their number might exceed the row count. |
You can assign me, if you want. Imo there are 3 options:
|
good suggestions! this is not as easy as i thought as the number of inputs, rows, and outputs can differ, so a 2d array would always have regions that are not used, as you also observe. maybe we should rethink the benefits of changing the representation of the dna. what would we gain over the current implementation by either of the three options? |
I guess I am not telling any news that the theoretical benefits are less memory and faster compute (see eg: https://www.geeksforgeeks.org/python-lists-vs-numpy-arrays/). |
I think that one advantage of a representation as a multi-dimensional array would be that a lot of our code becomes easier. Especially the |
Any opinions here? |
in my opinion there's no need to change it from it's current form, but i would be convinced by an implementation that leads to a decrease in code complexity ;) |
closing for now. feel free to reopen in combination with a concrete implementation. |
The dna list has homogeneous types (all entries are integers), so we might as well use a numpy array to store its contents. For example this would make operations on the whole dna, e.g., as suggested in #157, faster.
The text was updated successfully, but these errors were encountered: