{
  "id": 191096,
  "title": "Library Updates of Tensorflow",
  "url": "/competitions/digit-recognizer/discussion/191096",
  "author_name": "Tomas Mantero",
  "post_date": "2020-10-14T16:20:01.515000",
  "votes": 4,
  "comment_count": 1,
  "views": null,
  "content": "<h5>Hello, if you are looking at old notebooks <strong>you will probably encountered  some errors.</strong> Next, I will indicate how to solve them. If you have any doubts or questions, do not hesitate to ask!</h5>\n<p>TensorFlow is in the process of deprecating the <code>.fit_generator</code> method. Now you must use the <code>.fit</code> method which now supports data augmentation. So you need to change <code>model.fit_generator</code> to <code>model.fit</code>. </p>\n<p>For example, it should look like this: </p>\n<pre><code>history = model.fit(datagen.flow(X_train,Y_train, batch_size=batch_size),\n                              epochs = epochs, \n                              validation_data = (X_val,Y_val),\n                              verbose = 2, \n                              steps_per_epoch=X_train.shape[0] // batch_size, \n                              callbacks=[learning_rate_reduction])\n</code></pre>\n<p>Due to library update, all <code>'acc'</code> keywords are now <code>'accuracy'</code>, so this part should look like this:</p>\n<pre><code>ax[1].plot(history.history['accuracy'], color='b', label=\"Training accuracy\")\nax[1].plot(history.history['val_accuracy'], color='r',label=\"Validation accuracy\")\n</code></pre>\n<p>Finally, you should change <code>monitor='val_acc'</code> to <code>monitor=\"val_loss\"</code> like this:</p>\n<pre><code>learning_rate_reduction = ReduceLROnPlateau(monitor=\"val_loss\", \n                                            patience=3, \n                                            verbose=1, \n                                            factor=0.5, \n                                            min_lr=0.00001)\n</code></pre>",
  "messages": [
    {
      "id": 1049666,
      "postDate": "2020-10-14T16:20:01.517Z",
      "content": "<h5>Hello, if you are looking at old notebooks <strong>you will probably encountered  some errors.</strong> Next, I will indicate how to solve them. If you have any doubts or questions, do not hesitate to ask!</h5>\n<p>TensorFlow is in the process of deprecating the <code>.fit_generator</code> method. Now you must use the <code>.fit</code> method which now supports data augmentation. So you need to change <code>model.fit_generator</code> to <code>model.fit</code>. </p>\n<p>For example, it should look like this: </p>\n<pre><code>history = model.fit(datagen.flow(X_train,Y_train, batch_size=batch_size),\n                              epochs = epochs, \n                              validation_data = (X_val,Y_val),\n                              verbose = 2, \n                              steps_per_epoch=X_train.shape[0] // batch_size, \n                              callbacks=[learning_rate_reduction])\n</code></pre>\n<p>Due to library update, all <code>'acc'</code> keywords are now <code>'accuracy'</code>, so this part should look like this:</p>\n<pre><code>ax[1].plot(history.history['accuracy'], color='b', label=\"Training accuracy\")\nax[1].plot(history.history['val_accuracy'], color='r',label=\"Validation accuracy\")\n</code></pre>\n<p>Finally, you should change <code>monitor='val_acc'</code> to <code>monitor=\"val_loss\"</code> like this:</p>\n<pre><code>learning_rate_reduction = ReduceLROnPlateau(monitor=\"val_loss\", \n                                            patience=3, \n                                            verbose=1, \n                                            factor=0.5, \n                                            min_lr=0.00001)\n</code></pre>",
      "rawMarkdown": "##### Hello, if you are looking at old notebooks **you will probably encountered  some errors.** Next, I will indicate how to solve them. If you have any doubts or questions, do not hesitate to ask!\n\nTensorFlow is in the process of deprecating the `.fit_generator` method. Now you must use the `.fit` method which now supports data augmentation. So you need to change `model.fit_generator` to `model.fit`. \n\nFor example, it should look like this: \n```\nhistory = model.fit(datagen.flow(X_train,Y_train, batch_size=batch_size),\n                              epochs = epochs, \n                              validation_data = (X_val,Y_val),\n                              verbose = 2, \n                              steps_per_epoch=X_train.shape[0] // batch_size, \n                              callbacks=[learning_rate_reduction])\n```\n\nDue to library update, all `'acc'` keywords are now `'accuracy'`, so this part should look like this:\n```\nax[1].plot(history.history['accuracy'], color='b', label=\"Training accuracy\")\nax[1].plot(history.history['val_accuracy'], color='r',label=\"Validation accuracy\")\n```\n\nFinally, you should change `monitor='val_acc'` to `monitor=\"val_loss\"` like this:\n```\nlearning_rate_reduction = ReduceLROnPlateau(monitor=\"val_loss\", \n                                            patience=3, \n                                            verbose=1, \n                                            factor=0.5, \n                                            min_lr=0.00001)\n```",
      "votes": 4
    },
    {
      "id": 1049771,
      "postDate": "2020-10-14T19:05:06.547Z",
      "content": "<p>Thank you for your posting!</p>",
      "rawMarkdown": "Thank you for your posting!",
      "votes": 1
    }
  ],
  "comments": [
    {
      "id": 1049771,
      "author_name": "marcomantero",
      "author_url": "",
      "post_date": "2020-10-14T19:05:06.547000",
      "content": "<p>Thank you for your posting!</p>",
      "votes": 1,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1049666": "##### Hello, if you are looking at old notebooks **you will probably encountered  some errors.** Next, I will indicate how to solve them. If you have any doubts or questions, do not hesitate to ask!\n\nTensorFlow is in the process of deprecating the `.fit_generator` method. Now you must use the `.fit` method which now supports data augmentation. So you need to change `model.fit_generator` to `model.fit`. \n\nFor example, it should look like this: \n```\nhistory = model.fit(datagen.flow(X_train,Y_train, batch_size=batch_size),\n                              epochs = epochs, \n                              validation_data = (X_val,Y_val),\n                              verbose = 2, \n                              steps_per_epoch=X_train.shape[0] // batch_size, \n                              callbacks=[learning_rate_reduction])\n```\n\nDue to library update, all `'acc'` keywords are now `'accuracy'`, so this part should look like this:\n```\nax[1].plot(history.history['accuracy'], color='b', label=\"Training accuracy\")\nax[1].plot(history.history['val_accuracy'], color='r',label=\"Validation accuracy\")\n```\n\nFinally, you should change `monitor='val_acc'` to `monitor=\"val_loss\"` like this:\n```\nlearning_rate_reduction = ReduceLROnPlateau(monitor=\"val_loss\", \n                                            patience=3, \n                                            verbose=1, \n                                            factor=0.5, \n                                            min_lr=0.00001)\n```",
    "1049771": "Thank you for your posting!"
  }
}