关键词 > Python代写

Convolutional Neural Networks Homework 2

发布时间:2022-03-07

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Homework 2

Convolutional Neural Networks

HW2- (individual work) (Total: 8 point)

➢  Homework 2 is due on March 9th, 2022, 12:30 PM. 6 students will present in the class.

➢  You will need to create your Github account, upload your code (.py or ipynb) to github. Copy your github code link in your homework submission, and also paste your code (in case your github link  cannot open)

➢  In your homework submission, you should include:

o Your Github code link

o Your code

o Your answer to the questions

o Visualization results (if any).

➢  Upload your homework to Blackboard. File Name: HW2_Last name_First name

[You can choose to use Pytorch or Keras]

1.  For this question, you will experiment with fully connected neural networks and convolutional neural networks.

 Download the cifar10 code from one ofthe links

https://github.com/fangjin/STAT6289/blob/main/Tensor-

beginning/cifar10.ipynb

or

https://github.com/keras-team/keras/blob/master/keras/datasets/cifar10.py

or

any available cifar10 code links online.

Answer the following questions by modifying the code .                      

(a)  Compare the accuracy of the convolutional neural network in the file on the cifar10 dataset to the accuracy

of simple dense neural networks with 0, 1, 2, 3 and 4 hidden layers of 512 rectified linear units each. Modify the code to obtain simple dense neural networks with 0, 1, 2, 3 and 4 hidden layers of 512 rectified linear units (with a dropout rate of 0.5). Produce a graph that contains 6 curves (one for the convolutional neural net and one for each dense neural net of 0-4 hidden layers). The y-axis is the test (validation) accuracy and the x-axis is the number of epochs (# of passes through the training set). Produce curves for the first 10 epochs. Although 10 epochs is not sufficient to reach convergence, it is sufficient to see the trend. Explain the results (i.e., why some models perform better or worse than other models). [3 points]

[Your results will look similar like thisfigure ]

 

(b)  Compare the accuracy achieved by rectified linear units and sigmoid units in the convolutional neural

network in the code. Modify the code to use sigmoid units. Produce a graph that contains 2 curves (one for rectified linear units and another one for sigmoid units). The y-axis is the test (validation) accuracy and the x-axis is the number of epochs (# of passes through the training set). Produce curves for the first 10 epochs. Although 10 epochs is not sufficient to reach convergence, it is sufficient to see the trend. Explain the results (i.e., why did one model perform better than the other model). [2.5 points]

(c)  Compare the accuracy achieved with and without drop out as well as with and without data augmentation in the convolutional neural network in the code. Modify the code in to turn on and off dropout as well as data augmentation. Produce two graphs (one for training accuracy and the other one for test accuracy) that each contain 4 curves (with and without dropout as well as with and without data augmentation). The y-axis is the accuracy (i.e., train or test/validation accuracy) and the x- axis is the number of epochs (# of passes through the training set). Produce curves for as many epochs as you can up to 100 epochs. Explain the results (i.e., why did some models perform better or worse than other models and are the results consistent with the theory). No marks will be deducted for doing less than 100 epochs, however make sure to explain what you expect to see in the curves as the number of epochs reaches 100. [2.5 points]