{
  "id": 276230,
  "title": "TensorFlow fit bug",
  "url": "/competitions/rsna-miccai-brain-tumor-radiogenomic-classification/discussion/276230",
  "author_name": "",
  "post_date": "2021-10-03T18:22:33.300324600Z",
  "votes": 2,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Hi to all!<br>\nToday I faced a problem: when training each subsequent model, its serial number is automatically added to the name of all metrics for monitoring. As a result, tf.keras.callbacks.ModelCheckpoint does not work for the second and subsequent models, because the metric for monitoring is not called val_auc, but val_auc_2, val_auc_3, and so on. <br>\nThe easiest way to solve this problem is to add the following line:<br>\ntf.keras.backend.clear_session () <br>\n(source <a href=\"https://stackoverflow.com/questions/63612289/keras-earlystopping-callback-on-val-auc-running-mysteriously\" target=\"_blank\">https://stackoverflow.com/questions/63612289/keras-earlystopping-callback-on-val-auc-running-mysteriously</a>)<br>\nGood luck to all!</p>",
  "messages": [
    {
      "id": "1533166",
      "postDate": "10/03/2021 18:22:33",
      "content": "<p>Hi to all!<br>\nToday I faced a problem: when training each subsequent model, its serial number is automatically added to the name of all metrics for monitoring. As a result, tf.keras.callbacks.ModelCheckpoint does not work for the second and subsequent models, because the metric for monitoring is not called val_auc, but val_auc_2, val_auc_3, and so on. <br>\nThe easiest way to solve this problem is to add the following line:<br>\ntf.keras.backend.clear_session () <br>\n(source <a href=\"https://stackoverflow.com/questions/63612289/keras-earlystopping-callback-on-val-auc-running-mysteriously\" target=\"_blank\">https://stackoverflow.com/questions/63612289/keras-earlystopping-callback-on-val-auc-running-mysteriously</a>)<br>\nGood luck to all!</p>",
      "rawMarkdown": "Hi to all!\nToday I faced a problem: when training each subsequent model, its serial number is automatically added to the name of all metrics for monitoring. As a result, tf.keras.callbacks.ModelCheckpoint does not work for the second and subsequent models, because the metric for monitoring is not called val_auc, but val_auc_2, val_auc_3, and so on. \nThe easiest way to solve this problem is to add the following line:\ntf.keras.backend.clear_session () \n(source https://stackoverflow.com/questions/63612289/keras-earlystopping-callback-on-val-auc-running-mysteriously)\nGood luck to all!",
      "votes": null
    },
    {
      "id": "1533820",
      "postDate": "10/04/2021 11:41:57",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/aikhmelnytskyy\" target=\"_blank\">@aikhmelnytskyy</a> </p>\n<p>You can use the following method to force TF to use a specified name:<br>\n<code>roc_auc = tf.keras.metrics.AUC(name='roc_auc', curve='ROC')</code><br>\n<code>model.compile(optimizer=...,  loss=..., metrics=[roc_auc, ...])</code></p>",
      "rawMarkdown": "Hi @aikhmelnytskyy \n\nYou can use the following method to force TF to use a specified name:\n`roc_auc = tf.keras.metrics.AUC(name='roc_auc', curve='ROC')`\n`model.compile(optimizer=...,  loss=..., metrics=[roc_auc, ...])`",
      "votes": null
    },
    {
      "id": "1534523",
      "postDate": "10/05/2021 02:24:51",
      "content": "<p>I tried using this with my EarlyStopping and it seemed to remember my prior metrics between runs.  Is that possible?</p>",
      "rawMarkdown": "I tried using this with my EarlyStopping and it seemed to remember my prior metrics between runs.  Is that possible?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1533820,
      "author_name": "mikecho",
      "author_url": "",
      "post_date": "10/04/2021 11:41:57",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/aikhmelnytskyy\" target=\"_blank\">@aikhmelnytskyy</a> </p>\n<p>You can use the following method to force TF to use a specified name:<br>\n<code>roc_auc = tf.keras.metrics.AUC(name='roc_auc', curve='ROC')</code><br>\n<code>model.compile(optimizer=...,  loss=..., metrics=[roc_auc, ...])</code></p>",
      "votes": null,
      "replies": [
        {
          "id": 1534523,
          "author_name": "mmellinger66",
          "author_url": "",
          "post_date": "10/05/2021 02:24:51",
          "content": "<p>I tried using this with my EarlyStopping and it seemed to remember my prior metrics between runs.  Is that possible?</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1533166": "Hi to all!\nToday I faced a problem: when training each subsequent model, its serial number is automatically added to the name of all metrics for monitoring. As a result, tf.keras.callbacks.ModelCheckpoint does not work for the second and subsequent models, because the metric for monitoring is not called val_auc, but val_auc_2, val_auc_3, and so on. \nThe easiest way to solve this problem is to add the following line:\ntf.keras.backend.clear_session () \n(source https://stackoverflow.com/questions/63612289/keras-earlystopping-callback-on-val-auc-running-mysteriously)\nGood luck to all!",
    "1533820": "Hi @aikhmelnytskyy \n\nYou can use the following method to force TF to use a specified name:\n`roc_auc = tf.keras.metrics.AUC(name='roc_auc', curve='ROC')`\n`model.compile(optimizer=...,  loss=..., metrics=[roc_auc, ...])`",
    "1534523": "I tried using this with my EarlyStopping and it seemed to remember my prior metrics between runs.  Is that possible?"
  },
  "source": "meta"
}