Skip to content

Commit c8e3d2e

Browse files
committed
shuffle before each epoch
1 parent a21e844 commit c8e3d2e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

LeNet-Lab-Solution.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@
309309
"## Train the Model\n",
310310
"Run the training data through the training pipeline to train the model.\n",
311311
"\n",
312+
"Before each epoch, shuffle the training set.\n",
313+
"\n",
312314
"After each epoch, measure the loss and accuracy of the validation set.\n",
313315
"\n",
314316
"Save the model after training.\n",
@@ -331,6 +333,7 @@
331333
" print(\"Training...\")\n",
332334
" print()\n",
333335
" for i in range(EPOCHS):\n",
336+
" X_train, y_train = shuffle(X_train, y_train)\n",
334337
" for offset in range(0, num_examples, BATCH_SIZE):\n",
335338
" end = offset + BATCH_SIZE\n",
336339
" batch_x, batch_y = X_train[offset:end], y_train[offset:end]\n",

LeNet-Lab.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@
286286
"## Train the Model\n",
287287
"Run the training data through the training pipeline to train the model.\n",
288288
"\n",
289+
"Before each epoch, shuffle the training set.\n",
290+
"\n",
289291
"After each epoch, measure the loss and accuracy of the validation set.\n",
290292
"\n",
291293
"Save the model after training.\n",
@@ -308,6 +310,7 @@
308310
" print(\"Training...\")\n",
309311
" print()\n",
310312
" for i in range(EPOCHS):\n",
313+
" X_train, y_train = shuffle(X_train, y_train)\n",
311314
" for offset in range(0, num_examples, BATCH_SIZE):\n",
312315
" end = offset + BATCH_SIZE\n",
313316
" batch_x, batch_y = X_train[offset:end], y_train[offset:end]\n",

0 commit comments

Comments
 (0)