a.
- Run the code of 2 layer neural network from
- https://stackabuse.com/creating-a-neural-network-from-scratch-in-python-adding-hidden-layers/
- Go through the code and understand each line.
- Read the dataset as shown there.
- Two classes are there. Label 0 for one class, 1 for another class
- Take 70% data for training. 30% data for testing
- Build a two-layer neural network from from scratch where zo is the output.
a) You will have two layers.
i) One is hidden layers ( use 4 neurons)
ii) One output layer (use one output neuron)
b) Use sigmoid function as activation function in each neuron.
c) Use sum of square error as your loss function.
d) Calculate the derivatives for back propagation. - Write codes training module for 2000 epochs to train the neural network.
- Now classify the test data using the trained neural network.
a) During the test, you will do only forward pass.
b) If the forward pass score is , make the class label 1. Otherwise 0.
c) Report your accuracy. - Draw data points for training data and also plot the class boundary in 3D plot
- Draw data points for test data and also plot the class boundary in 3D plot
- You cannot use any built-in deep learning functions
b (same as a. But the input is 3X32X32 image instead of 3 numbers.
- Select any two classes from CIFAR 10 dataset. For example: Airplane, cat.
- So, airplane means numerical label 0, cat means 1
- Now, read one image, reshape it to row vector x. x is our input data now with dimension 1X3072.
- x's class label would be either 0 or 1.
- Now implement the same network architecture as above.
- Build a two-layer neural network from scratch where Y_pred is the output.
➢ You will have two layers.
• One is hidden layers ( use 1000 neurons)
• One output layer (use one output neuron)
➢ Use sigmoid function as activation function in each neuron.
➢ Use sum of square error as your loss function.
➢ Calculate the derivatives for back propagation. - Write codes training module for 10 epochs to train the neural network.
- Then, use the test images of airplane and cats from the test set.
- Supply the test images to the trained neural network and classify the images by using the Y_pred
as follows
➢ If (y_pred < 0.5) then class label is 0 else class label is 1. - Report your accuracy on the test set