Closed YevhenAkimov closed 2 years ago
This bug is fixed. You can verify with the following code snippet:
import keras_tuner as kt
class MyTuner(kt.BayesianOptimization):
def run_trial(self, trial, **kwargs):
if trial.hyperparameters.Boolean("break"):
return float("nan")
return trial.hyperparameters.Float("result", 0, 1)
tuner = MyTuner(max_trials=10, overwrite=True, directory="test")
tuner.search()
tuner.results_summary()
Or use this notebook.
More details:
From the original context, the BO tuner is using sklearn, which is no longer the case.
The Tuner
base class can handle NaN
s.
Please reopen it if it is not fixed.
Hi, during optimization with the bayesian tuner I encountered an error:
As far as I understand this is due to the difference in the error messages produced by scipy versions (I have scipy 1.16.1). Currently, Keras-tuner captures:
except ValueError as e: if "array must not contain infs or NaNs" in str(e): return self._random_populate_space() raise e
which is different from:ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
So, I guess the fix should be straightforward. Thanks.