Fall 2018 CS498DL

Assignment 1: Linear classifiers

Due date: Thursday, September 27th, 11:59:59PM

Credit: Daniel McKee, Maghav Kumar

In this assignment you will implement simple linear classifiers on the well-known CIFAR-10 image classification dataset. The goal of this assignment is to help you understand the fundamentals of a few classic methods and become familiar with scientific computing tools in python. You will also get experience in hyperparameter tuning and using proper train/test/validation data splits.

Download the starting code here.

You will implement the following classifiers (in their respective files):

  1. K-nearest neighbor (KNN.py)
  2. Perceptron (Perceptron.py)
  3. SVM (SVM.py)
  4. Softmax (Softmax.py)

The top-level notebook (CS 498DL Assignment-1.ipynb) will guide you through all the steps. Setup instructions are below. The format of this assignment is inspired by the Stanford CS231n assignments, and we have borrowed some of their data loading and instructions in our assignment ipython notebook.

None of the parts of this assignment require use of a machine with a GPU. You may complete the assignment using your local machine or you may use Google Colaboratory. However, we encourage you to try using Colaboratory if you donít have access to GPUs since Colaboratory provides free access to a Tesla K80 (for running short jobs).

Environment Setup (Local)

If you will be completing the assignment on a local machine then you will need a python environment set up with the appropriate packages.

We suggest that you use Anaconda to manage python package dependencies (https://www.anaconda.com/download). This guide provides useful information on how to use Conda: https://conda.io/docs/user-guide/getting-started.html.

Data Setup (Local)

Once you have downloaded the zip file, navigate to the cifar10 directory in MP1 and execute the get_dataset script provided:

cd MP1/cifar/

Data Setup (For Colaboratory)

If you are using Google Colaboratory for this assignment you will need do some additional setup steps.

Download the assignment zip file and follow the steps above to download CIFAR-10 to your local machine. Next, you should make a folder in your Google Drive to hold all of your assignment files and upload the entire assignment folder (including the cifar10 dataset you downloaded) into this Google drive file.

You will now need to open the assignment 1 ipython notebook file from your Google Drive folder in Colaboratory and run a few setup commands. You can find a detailed tutorial on these steps here (no need to worry about setting up GPU for now). However, we have condensed all the important commands you need to run into an ipython notebook.


The assignment is given to you in the CS 498DL Assignment-1.ipynb file. As mentioned, if you are using Colaboratory, you can open the ipython notebook directly in Colaboratory. If you are using a local machine, ensure that ipython is installed (https://ipython.org/install.html). You may then navigate the assignment directory in terminal and start a local ipython server using the jupyter notebook command.

Submission Instructions

Submission of this assignment will involve two steps:

  1. You must submit your output Kaggle CSV file from each of the four parts to their corresponding Kaggle competition webpages:
  2. The baseline accuracies you should approximately reach for each classifier are listed as benchmarks on each respective Kaggle leaderboard.

  3. You must upload three files on Compass 2g:
    1. All of your code (python files and ipynb file) in a single ZIP file. The filename should be netid_mp1_code.zip.
    2. Your ipython notebook with output cells converted to PDF format. The filename should be netid_mp1_output.pdf.
    3. A brief report in PDF format using this template. The filename should be netid_mp1_report.pdf.
    Don't forget to hit "Submit" after uploading your files, otherwise we will not receive your submission!

Please refer to course policies on collaborations, late submission, and extension requests.