sherpa-ai/sherpa

ValueError: Trial 10 does not exist or did not submit metrics.

MinuteswithMetrics opened this issue · 3 comments

I was able to get this to work in Kaggle Kernel. However, I hit a road block trying to figure out how to resolve ValueError : Trial 10 does not exist or did not submit metrics.

Any assistance would definitely help. I used this notebook as a guide.

https://github.com/peterjsadowski/keras_tutorial/blob/c941fee8f17940f697f438d3baabfcaea658a364/4_keras_mnist_SHERPA.ipynb

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   3077             try:
-> 3078                 return self._engine.get_loc(key)
   3079             except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'Trial-ID'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/sherpa/core.py in finalize(self, trial, status)
    148         try:
--> 149             rows = self.results.loc[self.results['Trial-ID'] == trial.id]
    150             if len(rows) == 0:

/opt/conda/lib/python3.6/site-packages/pandas/core/frame.py in __getitem__(self, key)
   2687         else:
-> 2688             return self._getitem_column(key)
   2689 

/opt/conda/lib/python3.6/site-packages/pandas/core/frame.py in _getitem_column(self, key)
   2694         if self.columns.is_unique:
-> 2695             return self._get_item_cache(key)
   2696 

/opt/conda/lib/python3.6/site-packages/pandas/core/generic.py in _get_item_cache(self, item)
   2488         if res is None:
-> 2489             values = self._data.get(item)
   2490             res = self._box_item_values(item, values)

/opt/conda/lib/python3.6/site-packages/pandas/core/internals.py in get(self, item, fastpath)
   4114             if not isna(item):
-> 4115                 loc = self.items.get_loc(item)
   4116             else:

/opt/conda/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   3079             except KeyError:
-> 3080                 return self._engine.get_loc(self._maybe_cast_indexer(key))
   3081 

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'Trial-ID'

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-27-8694891612ba> in <module>()
----> 1 study.finalize(trial=trial)
      2 
      3 print(study.get_best_result())

/opt/conda/lib/python3.6/site-packages/sherpa/core.py in finalize(self, trial, status)
    152         except KeyError:
    153             raise ValueError("Trial {} does not exist or did not "
--> 154                              "submit metrics.".format(trial.id))
    155 
    156         # Find best row as minimum or maximum objective

ValueError: Trial 10 does not exist or did not submit metrics.

Hi @MinuteswithMetrics ,
Apologies for the long delay on this. Unfortunately I wasn't able to reproduce the error. Were you in the end able to resolve this?

Hey @MinuteswithMetrics ,
Would you please share your notebook? The example notebook which you used as guide looks like completely fine. And here I also tried to produce the exception you got! But didn't occurred anything like you are getting. So, it would be better to investigate if you share your notebook.

@porimol My apologies for replaying back late. I believe I was able to get it to work. I'll double check my notebooks today