def test_generate_many_nns(self):
     """ Testing generation of many neural networks. """
     self.report('Testing generation of many NNs.')
     num_nns = 40
     cnns = nn_examples.generate_many_neural_networks('cnn', num_nns)
     visualise_list_of_nns(cnns, os.path.join(self.save_dir, 'cnn'))
     reg_mlps = nn_examples.generate_many_neural_networks(
         'mlp-reg', num_nns)
     visualise_list_of_nns(reg_mlps, os.path.join(self.save_dir,
                                                  'reg_mlps'))
     class_mlps = nn_examples.generate_many_neural_networks(
         'mlp-class', num_nns)
     visualise_list_of_nns(class_mlps,
                           os.path.join(self.save_dir, 'class_mlps'))
Example #2
0
 def _determine_next_batch_of_eval_points(self):
     """ Determine the next point for evaluation. """
     num_cands = max(20, 5 * self.num_workers)
     nns = generate_many_neural_networks('cnn', num_cands)
     rand_idxs = np.random.choice(num_cands,
                                  self.num_workers,
                                  replace=False)
     return [nns[i] for i in rand_idxs]
Example #3
0
 def _determine_next_eval_point(self):
     """ Determine the next point for evaluation. """
     num_cands = 20
     nns = generate_many_neural_networks('cnn', num_cands)
     rand_idx = np.random.randint(num_cands)
     return nns[rand_idx]
 def __init__(self, *args, **kwargs):
     """ Constructor. """
     super(NNOptUtilsTestClass, self).__init__(*args, **kwargs)
     num_nns = 20
     self.cnns = generate_many_neural_networks('cnn', num_nns)
     self.mlps = generate_many_neural_networks('mlp-reg', num_nns)