ThomasAlbin / Astroniz-YT-Tutorials

Repository of my Space Science with Python YT tutorial series
MIT License
143 stars 22 forks source link

module 'keras_tuner.oracles' has no attribute 'BayesianOptimization' (Cassini-CDA) #65

Closed fredifqh closed 1 year ago

fredifqh commented 1 year ago

I get the following error in the section Machine Learning Training:

AttributeError Traceback (most recent call last) Cell In[13], line 58 54 self.oracle.update_trial(trial.trial_id, {'val_loss': np.mean(val_losses)}) 56 # Build up the Tuner 57 tuner = CVTuner(hypermodel=build_model, ---> 58 oracle=keras_tuner.oracles.BayesianOptimization( 59 objective='val_loss', 60 max_trials=50), 61 overwrite=True, 62 project_name="CDA_IID_Calibration")

AttributeError: module 'keras_tuner.oracles' has no attribute 'BayesianOptimization'

ThomasAlbin commented 1 year ago

Hey there! That is strange. What keras_tuner version do you have? You can simply print it via:

import keras_tuner print(keras_tuner.__version__)

In my tutorials we use version 1.1.2. I just cross-checked it and was not able to reproduce the issue

fredifqh commented 1 year ago

Dear Thomas, thanks for your answer.

In fact, the problem was the keras_tuner version. I got the error with 1.3.5 version. I installed version 1.1.2 and now it is working.

ThomasAlbin commented 1 year ago

Thanks for the update! Hmmm am I THAT outdated? I should check the versioning.

Thanks again. I'd close this issue now