Skip to content

KeyError: job exception: 'val_acc' #285

@DagonArises

Description

@DagonArises

The error occurred before model evaluation:

Epoch 1/2                                            
422/422 - 3s - loss: 1.7380 - accuracy: 0.4183 - val_loss: 0.8082 - val_accuracy: 0.8570

Epoch 2/2                                            
422/422 - 2s - loss: 0.9614 - accuracy: 0.6891 - val_loss: 0.4583 - val_accuracy: 0.8960

  0%|          | 0/5 [00:05<?, ?trial/s, best loss=?]
job exception: 'val_acc'
  0%|          | 0/5 [00:05<?, ?trial/s, best loss=?]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-cf1d0fa8fe34> in <module>()
     82                                           max_evals=5,
     83                                           trials=Trials(),
---> 84                                           notebook_name='Deep learning GridSearch')
     85     X_train, Y_train, X_test, Y_test = data()
     86     print("Evalutation of best performing model:")

~/anaconda3/lib/python3.6/site-packages/hyperas/optim.py in minimize(model, data, algo, max_evals, trials, functions, rseed, notebook_name, verbose, eval_space, return_space, keep_temp)
     67                                      notebook_name=notebook_name,
     68                                      verbose=verbose,
---> 69                                      keep_temp=keep_temp)
     70 
     71     best_model = None

~/anaconda3/lib/python3.6/site-packages/hyperas/optim.py in base_minimizer(model, data, functions, algo, max_evals, trials, rseed, full_model_string, notebook_name, verbose, stack, keep_temp)
    137              trials=trials,
    138              rstate=np.random.RandomState(rseed),
--> 139              return_argmin=True),
    140         get_space()
    141     )

~/anaconda3/lib/python3.6/site-packages/hyperopt/fmin.py in fmin(fn, space, algo, max_evals, timeout, loss_threshold, trials, rstate, allow_trials_fmin, pass_expr_memo_ctrl, catch_eval_exceptions, verbose, return_argmin, points_to_evaluate, max_queue_len, show_progressbar, early_stop_fn, trials_save_file)
    520             show_progressbar=show_progressbar,
    521             early_stop_fn=early_stop_fn,
--> 522             trials_save_file=trials_save_file,
    523         )
    524 

~/anaconda3/lib/python3.6/site-packages/hyperopt/base.py in fmin(self, fn, space, algo, max_evals, timeout, loss_threshold, max_queue_len, rstate, verbose, pass_expr_memo_ctrl, catch_eval_exceptions, return_argmin, show_progressbar, early_stop_fn, trials_save_file)
    697             show_progressbar=show_progressbar,
    698             early_stop_fn=early_stop_fn,
--> 699             trials_save_file=trials_save_file,
    700         )
    701 

~/anaconda3/lib/python3.6/site-packages/hyperopt/fmin.py in fmin(fn, space, algo, max_evals, timeout, loss_threshold, trials, rstate, allow_trials_fmin, pass_expr_memo_ctrl, catch_eval_exceptions, verbose, return_argmin, points_to_evaluate, max_queue_len, show_progressbar, early_stop_fn, trials_save_file)
    551 
    552     # next line is where the fmin is actually executed
--> 553     rval.exhaust()
    554 
    555     if return_argmin:

~/anaconda3/lib/python3.6/site-packages/hyperopt/fmin.py in exhaust(self)
    354     def exhaust(self):
    355         n_done = len(self.trials)
--> 356         self.run(self.max_evals - n_done, block_until_done=self.asynchronous)
    357         self.trials.refresh()
    358         return self

~/anaconda3/lib/python3.6/site-packages/hyperopt/fmin.py in run(self, N, block_until_done)
    290                 else:
    291                     # -- loop over trials and do the jobs directly
--> 292                     self.serial_evaluate()
    293 
    294                 self.trials.refresh()

~/anaconda3/lib/python3.6/site-packages/hyperopt/fmin.py in serial_evaluate(self, N)
    168                 ctrl = base.Ctrl(self.trials, current_trial=trial)
    169                 try:
--> 170                     result = self.domain.evaluate(spec, ctrl)
    171                 except Exception as e:
    172                     logger.error("job exception: %s" % str(e))

~/anaconda3/lib/python3.6/site-packages/hyperopt/base.py in evaluate(self, config, ctrl, attach_attachments)
    905                 print_node_on_error=self.rec_eval_print_node_on_error,
    906             )
--> 907             rval = self.fn(pyll_rval)
    908 
    909         if isinstance(rval, (float, int, np.number)):

~/Desktop/honours thesis/thesis/thesis proposal/NLP tutorial/temp_model.py in keras_fmin_fnct(space)

KeyError: 'val_acc'

My code is exactly the 'complete example', except added 'notebook_name' in optim.minimize. Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions