Skip to content

Commit 7c64903

Browse files
committed
Use f-strings instead of str concat for train/eval summary.
1 parent 82c5bee commit 7c64903

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

content/tutorial-deep-learning-on-mnist.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -544,17 +544,13 @@ for j in range(epochs):
544544
545545
# Summarize error and accuracy metrics at each epoch
546546
print(
547-
"\n"
548-
+ "Epoch: "
549-
+ str(j)
550-
+ " Training set error:"
551-
+ str(training_loss / float(len(training_images)))[0:5]
552-
+ " Training set accuracy:"
553-
+ str(training_accurate_predictions / float(len(training_images)))
554-
+ " Test set error:"
555-
+ str(test_loss / float(len(test_images)))[0:5]
556-
+ " Test set accuracy:"
557-
+ str(test_accurate_predictions / float(len(test_images)))
547+
(
548+
f"Epoch: {j}\n"
549+
f" Training set error: {training_loss / len(training_images):.3f}\n"
550+
f" Training set accuracy: {training_accurate_predictions / len(training_images)}\n"
551+
f" Test set error: {test_loss / len(test_images):.3f}\n"
552+
f" Test set accuracy: {test_accurate_predictions / len(test_images)}"
553+
)
558554
)
559555
```
560556

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy