Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a Neural Network(NN): a. Using tensorflow.keras.datasets import the MNIST dataset. (https://www.tensorflow.org/api_docs/python/tf/keras/datasets/mnist) b. Transform each image (2D: 28x28) to 1D array (1D: 784) using Pandas

Implement a Neural Network(NN):

a. Using tensorflow.keras.datasets import the MNIST dataset. (https://www.tensorflow.org/api_docs/python/tf/keras/datasets/mnist)

b. Transform each image (2D: 28x28) to 1D array (1D: 784) using Pandas or Numpy.

c. Let's define the data for the binary classification. From the training and testing datasets select all the samples corresponding to the classes 0 and 1. It will result in 12000 samples for training and 2000 for testing. This is the data you will use in this project.

d. Use the selected data to train a shallow NN:

1. Build a shallow neural network with the following hyperparameters: Activation functions: relu, Number of hidden layers: 3, Neurons per layer: 512, Optimizer: adam, Loss: binary_crossentropy, Metric: accuracy, Epochs: 20

2. Train the NN using 10% (1200 samples) of the training data and 100% (2000 samples) of the testing data. Analyze the training and testing accuracy.

3. Train the network using 100% of the training (12000 samples) data and evaluate the model using 100% (2000 samples) of testing data.

4. Assume that the only available data is the 12000 training samples. Take 25% of the training data (3000 samples) and use it for testing. Use the remaining 75% (9000) for training. Compare the accuracy of the model to the results obtained from parts 2 and 3.

5. Define the network such as it has 8 neurons per layer. Train the NN using 100% of the training data (12000) and evaluate the model with the 100% of testing data (2000).

6.For each part from d2 to d5 answer the following questions:

Q1: Are the accuracy results due to overfitting, underfitting or other? why? Justify your answer.

Q2: What part of the percentage in the testing/training process is affecting the results?

e. List which of the hyperparameters in d1 would you modify (without increasing the number of layers) to improve the testing accuracy for the NN in d2. Justify your answer.

f. Plot the model architecture created in d2.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

Who is the assigned manager for each tactic?

Answered: 1 week ago

Question

1. Prepare a flowchart of Dr. Mahalees service encounters.

Answered: 1 week ago