You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: episodes/05-train_eval.md
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -200,29 +200,6 @@ Remember to retrain your model after making this change.
200
200
201
201
:::::::::::::::::::::::::::::::::::::::
202
202
203
-
## Evaluating your model on the held-out test set
204
-
205
-
In this step, we present the unseen test dataset to our trained network and evaluate the performance.
206
-
207
-
```python
208
-
from tensorflow.keras.models import load_model
209
-
210
-
# Open the best model saved during training
211
-
best_model = load_model('best_model.keras')
212
-
print('\nNeural network weights updated to the best epoch.')
213
-
```
214
-
215
-
Now that we've loaded the best model, we can evaluate the accuracy on our test data.
216
-
217
-
```python
218
-
# We use the evaluate function to evaluate the accuracy of our model in the test group
219
-
print(f"Accuracy in test group: {best_model.evaluate(dataset_test, labels_test, verbose=0)[1]}")
220
-
```
221
-
222
-
```output
223
-
Accuracy in test group: 0.80
224
-
```
225
-
226
203
## Choosing and modifying the architecture
227
204
228
205
There is no single “correct” architecture for a neural network. The best design depends on your data, task, and computational constraints. Here is a systematic approach to designing and improving your model architecture:
@@ -263,6 +240,29 @@ To reduce overfitting, consider:
263
240
- Data augmentation
264
241
- Early stopping
265
242
243
+
## Evaluating your model on the held-out test set
244
+
245
+
In this step, we present the unseen test dataset to our trained network and evaluate the performance.
246
+
247
+
```python
248
+
from tensorflow.keras.models import load_model
249
+
250
+
# Open the best model saved during training
251
+
best_model = load_model('best_model.keras')
252
+
print('\nNeural network weights updated to the best epoch.')
253
+
```
254
+
255
+
Now that we've loaded the best model, we can evaluate the accuracy on our test data.
256
+
257
+
```python
258
+
# We use the evaluate function to evaluate the accuracy of our model in the test group
259
+
print(f"Accuracy in test group: {best_model.evaluate(dataset_test, labels_test, verbose=0)[1]}")
0 commit comments