09.05.2023 Views

pdfcoffee

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Neural Network Foundations with TensorFlow 2.0

Running a simple TensorFlow 2.0 net and

establishing a baseline

So let's see what happens when we run the code:

Figure 13: Code ran from our test neural network

First, the net architecture is dumped and we can see the different types of layers

used, their output shape, how many parameters (that is, how many weights) they

need to optimize, and how they are connected. Then, the network is trained on

48,000 samples, and 12,000 are reserved for validation. Once the neural model is

built, it is then tested on 10,000 samples. For now, we won't go into the internals of

how the training happens, but we can see that the program runs for 200 iterations

and each time accuracy improves. When the training ends, we test our model on the

test set and we achieve about 89.96% accuracy on training, 90.70% on validation, and

90.71% on test:

Figure 14: Results from testing model, accuracies displayed

This means that nearly 1 in 10 images are incorrectly classified. We can certainly do

better than that.

[ 20 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!