Search code examples
tensorflowkerascallback

Keras early stopping callback does not recognise 'start_from_epoch' argument


For some reason the start_from_epoch argument in the EarlyStopping callback is not recognised.

import tensorflow as tf

cbk = [tf.keras.callbacks.EarlyStopping(monitor='val_loss',
                                       min_delta=0,
                                       patience=3,
                                       restore_best_weights = True,
                                       start_from_epoch=10
                                       )]

TypeError: __init__() got an unexpected keyword argument 'start_from_epoch'

even though it's clearly listed as an argument in the documentation

I have recent versions of TensorFlow installed, so anyone know why this is the case?


Solution

  • I think you are using older version of Tensorflow Try this

    !pip install -q tensorflow==2.11.0

        monitor='val_loss',
        min_delta=0,
        patience=0,
        verbose=0,
        mode='auto',
        baseline=None,
        restore_best_weights=False,
        start_from_epoch=0
    )