Skip to content
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

imporve from_genes implementation #26

Open
mauicv opened this issue Mar 29, 2021 · 0 comments
Open

imporve from_genes implementation #26

mauicv opened this issue Mar 29, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@mauicv
Copy link
Owner

mauicv commented Mar 29, 2021

Currently datastore saves the genome structure as all nodes and edges includeing input and output nodes but from_genes hydrator factory expects num_inputs and num_outputs and that the nodes and edge lists passed are only hidden nodes. Hence to use from_nodes with datastore we have to do:

generation = ds.load(generation_in)
nodes, edges = last_gen['best_genome']
input_num = len([n for n in nodes if n[4] == 'input'])
output_num = len([n for n in nodes if n[4] == 'output'])
nodes = [n for n in nodes if n[4] == 'hidden']
genome = from_genes(
    nodes, edges,
    input_size=input_num,
    output_size=output_num,
    weight_low=-2,
    weight_high=2,
    depth=len(LAYER_DIMS))

Similarly computing the number of layers is not trivial and should be just be a value stored in some meta data either on the generation or the DataStore class itself.

@mauicv mauicv added the enhancement New feature or request label Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant