aibharata / medicalAI

Medical-AI is a AI framework specifically for Medical Applications https://aibharata.github.io/medicalAI/
Apache License 2.0
19 stars 8 forks source link

Medicalai ErrorStoppping Not Working #8

Open zeynepkoyun opened 3 years ago

zeynepkoyun commented 3 years ago

Hi @aibharata

When we want to stop the training early with medicalai via a callback called EarlyStopping, it gives an error at line 209 in the file "medicalai/chief/core.py". How should the data be defined here, because it is desired to behave like a string first and then a dictionary. Can you share sample data?

Error line

if bestModelCond is not None and bestModelCond.lower() != 'default': print('\n[INFO]: ENGINE INITIALIZED WITH "SAVING BEST MODEL" and Early Stopping MODE\n') earlystop_callback = tf.keras.callbacks.EarlyStopping( monitor=bestModelCond['monitor'], min_delta=bestModelCond['min_delta'], patience=bestModelCond['patience'] ) if callbacks is None: callbacks=[earlystop_callback] else: callbacks.append(earlystop_callback)

zeynepkoyun commented 2 years ago

Hi @aibharata

When we want to stop the training early with medicalai via a callback called EarlyStopping, it gives an error at line 209 in the file "medicalai/chief/core.py". How should the data be defined here, because it is desired to behave like a string first and then a dictionary. Can you share sample data?

Error line

if bestModelCond is not None and bestModelCond.lower() != 'default': print('\n[INFO]: ENGINE INITIALIZED WITH "SAVING BEST MODEL" and Early Stopping MODE\n') earlystop_callback = tf.keras.callbacks.EarlyStopping( monitor=bestModelCond['monitor'], min_delta=bestModelCond['min_delta'], patience=bestModelCond['patience'] ) if callbacks is None: callbacks=[earlystop_callback] else: callbacks.append(earlystop_callback)

Hi @aibharata

is there any progress on this?

aibharata commented 2 years ago

Hi @zeynepkoyun,

Thank you for bringing this to our notice. There are a few bugs here. bestModelCond = 'default'should have initialized the conditions, but it doesn't as of now.

Currently, it expects a dictionary. You can initialize and pass bestModelCond like this :

bestModelCond  = {
    monitor='val_accuracy', 
    patience=8, 
    min_delta=0.001, 
}

We will issue a bug fix in a few days to support more conditions.

By the way, which version are you using currently? 1.1.59 or 1.2.9.2rc0

zeynepkoyun commented 2 years ago

Merhaba @zeynepkoyun ,

Bunu dikkatimize sunduğunuz için teşekkür ederiz. Burada birkaç bug var. bestModelCond = 'default'koşulları başlatmalıydı, ama şu an için değil.

Şu anda, bir sözlük bekliyor. bestModelCond'u şu şekilde başlatabilir ve iletebilirsiniz:

bestModelCond  = {
    monitor='val_accuracy', 
    patience=8, 
    min_delta=0.001, 
}

Daha fazla koşulu desteklemek için birkaç gün içinde bir hata düzeltmesi yayınlayacağız.

Bu arada, şu anda hangi sürümü kullanıyorsunuz? 1.1.59 or 1.2.9.2rc0

Hi @aibharata I'll try and let you know. The version I am currently using is 1.1.59. I will be waiting for the new version.