YerevaNN / mimic3-benchmarks

Python suite to construct benchmark machine learning datasets from the MIMIC-III 💊 clinical database.
https://arxiv.org/abs/1703.07771
MIT License
806 stars 329 forks source link

AttributeError: module 'keras.backend' has no attribute 'observe_object_name' #117

Closed kohkev closed 3 years ago

kohkev commented 3 years ago

Hello together, first things first: thank you for this great, highly helpful repository!

At the moment I am trying to run the LSTM/Keras model for the In-Hospital-Mortality Prediction. When executing the code

  python -um mimic3models.in_hospital_mortality.main --network mimic3models/keras_models/lstm.py --dim 16 --timestep 1.0 --depth 2 --dropout 0.3 --mode train --batch_size 8 --output_dir mimic3models/in_hospital_mortality

the following errors appears:

Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,

  File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)

  File "D:\Thesis\mimic3-benchmarks-master\mimic3models\in_hospital_mortality\main.py", line 67, in <module>
    model = model_module.Network(**args_dict)

  File "mimic3models/keras_models/lstm.py", line 36, in __init__
    X = Input(shape=(None, input_dim), name='X')

  File "C:\Users\Anon\AppData\Roaming\Python\Python39\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from None

  File "C:\Users\Anon\AppData\Roaming\Python\Python39\site-packages\keras\engine\base_layer.py", line 2460, in _init_set_name    backend.observe_object_name(name)

AttributeError: module 'keras.backend' has no attribute 'observe_object_name'

My versioning:

After the error raises, I see an unresolved import for mimic3models.keras_utils. Already tried it with downgrading Tensorflow but it didn't work. Did anyone of you encounter the same error? Thanks!

kohkev commented 3 years ago

Problem could be solved by downgrading Python to 3.8.5, thus I'm closing the issue.