Assignment 2
In this assignment, you will implement various image classification models, based on the SVM / Softmax / Two-layer Neural Network. The goals of this assignment are as follows:
- Implement and apply a Multiclass Support Vector Machine (SVM) classifier
- Implement and apply a Softmax classifier
- Implement and apply a Two-layer Neural Network classifier
- Understand the differences and tradeoffs between these classifiers
- Understand how a Two-layer Neural Network can approximate an arbitrary function
- Practice implementing vectorized gradient code by checking against naive implementations, and using numeric gradient checking
This assignment is due on Friday, January 28th at 11:59pm EDT.
Q1: Linear Classifiers (57 points)
The notebook linear_classifier.ipynb will walk you through implmenting SVM and Softmax classifier. You are required to write code on linear_classifier.py.
Q2: Two-layer Neural Network (38 points)
The notebook two_layer_net.ipynb will walk you through implementing a two-layer neural network-based classifier. Your implementation will go to two_layer_net.py.
Q3: MNIST Challenge (5 points)
The notebook challenge_problem.ipynb will walk you through the challenge problem where you will manually set the weights of a Two-layer Neural Network classifier and evaluate on MNIST hand drawn digits.
Steps
1. Download the zipped assignment file
2. Unzip all and open the Colab file from the Drive
Once you unzip the downloaded content, please upload the folder to your Google Drive.
Then, open each *.ipynb
notebook file with Google Colab by right-clicking the *.ipynb file.
We recommend editing your *.py
file on Google Colab, set the ipython notebook and the code side by side.
For more information on using Colab, please see our Colab tutorial.
3. Work on the assignment
Work through the notebook, executing cells and writing code in *.py,
as indicated.
You can save your work, both *.ipynb
and *.py,
in Google Drive (click “File” -> “Save”) and resume later if you don’t want to complete it all at once.
While working on the assignment, keep the following in mind:
- The notebook and the python file have clearly marked blocks where you are expected to write code. Do not write or modify any code outside of these blocks.
- Do not add or delete cells from the notebook. You may add new cells to perform scratch computations, but you should delete them before submitting your work.
- Run all cells, and do not clear out the outputs, before submitting. You will only get credit for code that has been run.
4. Evaluate your implementation on Autograder
Once you want to evaluate your implementation,
please submit the *.py
and *.ipynb
files to Autograder for grading your implementations in the middle or after implementing everything. You can partially grade some of the files in the middle, but please make sure that this also reduces the daily submission quota. Please check our Autograder tutorial for details.
5. Download .zip file
Once you have completed a notebook, download the completed uniqueid_umid_A2.zip
file, which is generated from your last cell of the challenge_problem.ipynb
file. Before executing the last cell in challenge_problem
, please manually save your results so that the zip file includes all updates.
Make sure your downloaded zip file includes your most up-to-date edits; the zip file should include linear_classifier.ipynb, two_layer_net.ipynb,challenge_problem.ipynb, linear_classifier.py, two_layer_net.py, svm_best_model.pt, softmax_best_model.pt, nn_best_model.pt, hand_drawn_weights.jpeg for this assignment.
6. Submit your python and ipython notebook files to Autograder
When you are done, please upload your work to Autograder (UMich enrolled students only). Your *.ipynb
files SHOULD include all the outputs. Please check your outputs up to date before submitting yours to Autograder.