ICP 9 - AsharGit/Python-ICP GitHub Wiki

Welcome to the Python-ICP-9 wiki!

This ICP we learn to use Neural Networks for image classification

Video for this ICP: https://youtu.be/nqpAKpNawQs

The first task for this ICP is to plot our accuracy and loss

For this we plot and compare val_accuracy with accuracy in our training and testing data and do the same with loss

The code is similar where we assign our independent and dependent variables and plot them using matplotlib

The accuracy model graph

The loss model graph

The output accuracy and loss of the tested data:

The second task of this ICP is to identify a sample data image from our dataset

For this task we run our neural network and use a sample image to test our network's ability to identify the number.

We reshape the sample image into a 28x28 image for the purpose of plotting

We then reshape again to 1x784 and use inference on the model to predict the number on the image

The image

The resulting prediction

The next task in the ICP is to add layers and to change the activation function of the model

I added one more layer and changed the activation function from relu to tanh. I got similar results with sigmoid and tanh.

The accuracy of our model with an additional layer and tanh activation in this test raised the accuracy score from 0.982 to 0.983

The results would fluctuate from test to test so it's hard to say if the there was an improvement in accuracy

However the loss did drop from 0.146 to 0.085

The final task was to check whether removing scaling and check the performance

By removing scaling on our data the accuracy of our model dropped from 0.983 to 0.974

Thus scaling our data shows improvement to the accuracy score