Skip to content

Commit c5a9714

Browse files
Merge pull request #2178 from cbhyphen:patch-1
PiperOrigin-RevId: 503464565
2 parents 8f431e2 + b2ad834 commit c5a9714

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

site/en/guide/migrate/early_stopping.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@
457457
"epochs = 100\n",
458458
"patience = 5\n",
459459
"wait = 0\n",
460-
"best = 0\n",
460+
"best = float('inf')\n",
461461
"\n",
462462
"for epoch in range(epochs):\n",
463463
" print(\"\\nStart of epoch %d\" % (epoch,))\n",
@@ -486,7 +486,7 @@
486486
" # The early stopping strategy: stop the training if `val_loss` does not\n",
487487
" # decrease over a certain number of epochs.\n",
488488
" wait += 1\n",
489-
" if val_loss > best:\n",
489+
" if val_loss < best:\n",
490490
" best = val_loss\n",
491491
" wait = 0\n",
492492
" if wait >= patience:\n",

0 commit comments

Comments
 (0)