简体   繁体   中英

Detecting overfitting or underfitting

I am making a model in TensorFlow, I detected that there was overfitting and after modifying the parameters of the model, it seems that there is no longer overfitting but I am not sure. I show you the two graphs that I get after the Tensorboard training.

epoch_loss:

epoch_loss

epoch_accuracy:

epoch_accuracy

After changing the Smoothing parameter on the side of TensorFlow it shows me the accuracy graph:

平滑

epoch_accuracy_Smoothing

I have two questions I want to ask you.

  1. What is the Smoothing parameter for?
  2. Do you see the model's behavior during training?

Thanks to all of you.

smoothing works like a moving average. If you increase its size, it will take more values in the near area and it will give this smoothed aspect. To better understand the mathematic behind, check this question .

Your model seems almost perfect (slightly underfit), I recommend you to continue the training for about 500-1000 additionnal epochs.

smoothing works as described in the other answers. Your model seems to be working correctly and is continuing to have decreasing training and validation loss TRENDS. I might suggest adding some BatchNormalization layers to your model to get smoother convergence. Documentation is here. I also recommend adding the callbacks as shown below

lra=tf.keras.callbacks.ReduceLROnPlateau(
    monitor="val_loss",
    factor=0.5,
    patience=1,
    verbose=1,
    mode="auto",
    min_delta=0.0001,
    cooldown=0,
    min_lr=0)

estop=tf.keras.callbacks.EarlyStopping(
    monitor="val_loss",
    min_delta=0,
    patience=4,
    verbose=1,
    mode="auto",
    baseline=None,
    restore_best_weights=True)
# in model.fit add
callbacks=[lra, estop]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM