jliphard / DeepEvolve

Rapid hyperparameter discovery for neural nets using genetic algorithms
Other
181 stars 56 forks source link

KeyError: 'nb_neurons_1' (on brute.py) #10

Open GiuseppeDiGuglielmo opened 5 years ago

GiuseppeDiGuglielmo commented 5 years ago

I am getting the following error. Am I doing anything wrong?

$ git clone git@github.com:jliphard/DeepEvolve.git
$ git log -1 --pretty=format:"%H"
e9bf389a658aacf52a1bdacf4697ae4a704c0452
$ python3 brute.py 
Using TensorFlow backend.
Traceback (most recent call last):
  File "brute.py", line 98, in <module>
    main()
  File "brute.py", line 93, in main
    genomes = generate_genome_list(all_possible_genes)
  File "brute.py", line 75, in generate_genome_list
    genome_obj.set_genes_to(genome, 0, 0)
  File "/nevis/milne/files/gd2392/research/projects/DeepEvolve/genome.py", line 102, in set_genes_to
    self.update_hash()
  File "/nevis/milne/files/gd2392/research/projects/DeepEvolve/genome.py", line 43, in update_hash
    + str(self.geneparam['nb_layers']) + self.geneparam['optimizer']
  File "/nevis/milne/files/gd2392/research/projects/DeepEvolve/genome.py", line 143, in nb_neurons
    nb_neurons[i] = self.geneparam['nb_neurons_' + str(i+1)]
KeyError: 'nb_neurons_1'
jliphard commented 5 years ago

No, you are not doing anything wrong. This is a bug in the code - the brute force code was broken by making the number of neurons variable for each layer, rather than using the same number of neurons per layer. The main code (main.py) runs correctly, but brute.py will need to be fixed. @gndowns or @SaumyaTiwari01 may be able to help with this, and if not, I'll try to get to this within the next few days.

jliphard commented 5 years ago

If you need working code right now, then you can use the known-good code: https://github.com/jliphard/DeepEvolve/tree/3ffc6d0b9d153206f9dda7278f3ac31217b2e406