Skip to content

Commit f3b75e1

Browse files
committed
Added activation function and increased epochs
Added non-linear ReLU activation function in order to make the network a non-linear function approximator which is usually a wanted property when using neural networks. The increase in epochs is necessary to see a significant difference between using an activation function and not using one.
1 parent 4d512c2 commit f3b75e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

site/en/tutorials/load_data/csv.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
"outputs": [],
227227
"source": [
228228
"abalone_model = tf.keras.Sequential([\n",
229-
" layers.Dense(64),\n",
229+
" layers.Dense(64, activation='relu'),\n",
230230
" layers.Dense(1)\n",
231231
"])\n",
232232
"\n",
@@ -251,7 +251,7 @@
251251
},
252252
"outputs": [],
253253
"source": [
254-
"abalone_model.fit(abalone_features, abalone_labels, epochs=10)"
254+
"abalone_model.fit(abalone_features, abalone_labels, epochs=30)"
255255
]
256256
},
257257
{
@@ -337,14 +337,14 @@
337337
"source": [
338338
"norm_abalone_model = tf.keras.Sequential([\n",
339339
" normalize,\n",
340-
" layers.Dense(64),\n",
340+
" layers.Dense(64, activation='relu'),\n",
341341
" layers.Dense(1)\n",
342342
"])\n",
343343
"\n",
344344
"norm_abalone_model.compile(loss = tf.keras.losses.MeanSquaredError(),\n",
345345
" optimizer = tf.keras.optimizers.Adam())\n",
346346
"\n",
347-
"norm_abalone_model.fit(abalone_features, abalone_labels, epochs=10)"
347+
"norm_abalone_model.fit(abalone_features, abalone_labels, epochs=30)"
348348
]
349349
},
350350
{
@@ -646,7 +646,7 @@
646646
"source": [
647647
"def titanic_model(preprocessing_head, inputs):\n",
648648
" body = tf.keras.Sequential([\n",
649-
" layers.Dense(64),\n",
649+
" layers.Dense(64, activation='relu'),\n",
650650
" layers.Dense(1)\n",
651651
" ])\n",
652652
"\n",
@@ -678,7 +678,7 @@
678678
},
679679
"outputs": [],
680680
"source": [
681-
"titanic_model.fit(x=titanic_features_dict, y=titanic_labels, epochs=10)"
681+
"titanic_model.fit(x=titanic_features_dict, y=titanic_labels, epochs=30)"
682682
]
683683
},
684684
{

0 commit comments

Comments
 (0)