Provided Code Skeleton
We have provided
( tar
zip)
all the code to get you started on your MP, which
means you will only have to implement the logic behind perceptron.
- reader.py - This file is responsible for reading in the data set.
It makes a giant NumPy array of feature vectors corresponding with each image.
- mp5.py - This is the main file that starts the program, and computes the
accuracy, precision, recall, and F1-score using your implementation of the classifers.
- classify.py This is the file where you will be doing all of your work.
Inside the code ...
- The function classifyPerceptron() and classifyLR() take as input the training data, training labels, development set,
learning rate, and maximum number of iterations.
-
The training data provided is the output from reader.py.
-
The training labels is the list of labels corresponding to each image in the training data.
-
The development set is the NumPy array of images that you are going to test your implementation on.
-
The learning rate is the hyperparameter you specified with --lrate (it is 1e-2 by default).
Please do not reset this value inside your code.
-
The maximium number of iterations is the number you specified with --max_iter (it is 10 by default).
Please do not reset this value inside your code.
-
You will have each classify() output the predicted labels for the development set from your models.
-
The function classifyEC() is a function where you can implement the extra credit, if you decide to
attempt it. If you use the --extra flag then classifyEC() will be ran instead of classify().
NOTE: In classify() only implement the models on the raw data. Do NOT do any extra credit or anything extra
in classify().
Do not modify the provided code. You will only have to modify classify.py.
To understand more about how to run the MP, run python3 mp5.py -h in your terminal.