๐ Challenge: Building the Network
Build the network for the MNIST dataset problem that we examined at in the previous lesson.
We'll cover the following
Problem statement
The preprocessed MNIST dataset has been provided. Specify the network architecture, compile, fit, and evaluate the model performance on the training data.
-
The model architecture should have 2 hidden layers with 60 and 60 nodes respectively and an output layer. The activation function for the first hidden layer should be
relu
and it should besigmoid for the second hidden layer
. The activation function for the output layer should besoftmax
. -
The model should be compiled with
adam
as an optimizer. -
The model should fit on the training data with 5
epochs
andbatch_size
equal to 128. -
Evaluate the model on the training data and check its accuracy.
Sample input
The preprocessed MNIST data is provided with:
- Training features:
X_train
- Training labels:
Y_train
- Testing features:
X_train
- Testing labels:
Y_train
Sample output
The trained model accuracy after defining the model architecture, the compile method, the fit method, and the evaluation model.
Coding exercise
Write your code below. It is recommendedโ to solve the exercise before viewing the solution.
Good luck!๐ค
Get hands-on with 1400+ tech skills courses.