Add missing math import and n_epochs = 20
parent
b38aff05a3
commit
873e1a986c
|
@ -2236,6 +2236,8 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"n_epochs = 20\n",
|
||||
"\n",
|
||||
"lr_scheduler = tf.keras.callbacks.LearningRateScheduler(exponential_decay_fn)\n",
|
||||
"history = model.fit(X_train, y_train, epochs=n_epochs,\n",
|
||||
" validation_data=(X_valid, y_valid),\n",
|
||||
|
@ -2366,9 +2368,10 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"n_epochs = 25\n",
|
||||
"import math\n",
|
||||
"\n",
|
||||
"batch_size = 32\n",
|
||||
"n_steps = n_epochs * np.ceil(len(X_train) / batch_size)\n",
|
||||
"n_steps = n_epochs * math.ceil(len(X_train) / batch_size)\n",
|
||||
"exp_decay = ExponentialDecay(n_steps)\n",
|
||||
"history = model.fit(X_train, y_train, epochs=n_epochs,\n",
|
||||
" validation_data=(X_valid, y_valid),\n",
|
||||
|
@ -4561,7 +4564,7 @@
|
|||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
@ -4575,7 +4578,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.10"
|
||||
"version": "3.10.13"
|
||||
},
|
||||
"nav_menu": {
|
||||
"height": "360px",
|
||||
|
|
Loading…
Reference in New Issue