ICP_Deep Learning 2 - PallaviArikatla/Python GitHub Wiki
INTRODUCTION: To work on neural networks,activation functions,Loss Functions and Minst datset of keras.
IMPLEMENTATION:
Question 1: Using the history object in the source code, plot the loss and accuracy for both training data and validation data.
-
Import all the necessary libraries to perform related operations.
-
Read the given data and split it to train and test.
-
Have to process the data and convert it to numeric form i.e., to 0 and 1.
-
Plot the image for trained data.
-
Encode the data and calculate loss and accuracy metrics.
-
Now the outputs will be as follows.
-
Output for trained data:
- Outputs for loss and accuracy:
CODE:
Loss and Accuracy:
PLOTS:
Loss:
Accuracy:
Question 2: plot one of the images in the test data, and then do inferencing to check what is the prediction of the model on that single image in the test data.
- Take the index value from the trained data followed by finding out predictions and plot the image as follows.
Question 3: We had used 2 hidden layers and Relu activation. Try to change the number of hidden layer and the activation to tanh or sigmoid and see the changes.
- Create a network by adding additional given layers with activation tanh and sigmoid.
- Train the model and make observations.
Loss Plot:
Accuracy Plot:
Question 4: Run the same code without scaling the images, how the accuracy changes.
- Remove the scaling and train the model.
- Infer the changes.
OUTPUT:
Inference:
After removal of scaling value of accuracy has decreased and loss value got increased.