Machine Problem 1: Eigenface
In MP1, you will perform nearest-neighbor classification of face images using eigenfaces, a.k.a. principal component analysis (PCA).
- Code, test code, data, and solutions.
- Reading: Gallager, pp. 43-45
- Reading: Eigenfaces for Recognition, Turk and Pentland, 1991
The ZIP Archive, and the recommended Code-Writing Process
In the ZIP archive, you will find the following directory hierarchy:
-
mp1.py -- this is the ONLY file that you
will submit, and the only file on which you will be
graded.
- The parts that you need to edit are marked with NotImplementedError, so you can find them easily.
-
If you run this from the command line,
python mp1.py
, it will generate a popup window (using tkinter) with a debugging visualization, in between each pair of steps. -
If you get tired of all the popup windows, you can
have it go directly to the step you want by typing
python mp1.py -s N
whereN
is any integer from 0 to 8.
- data -- contains the image files. These are from the LFW (Labeled Faces in the Wild) dataset. The autograder online will have some extra data, besides what's distributed here.
- solutions.hdf5 -- this is just what it say; complete solutions for the visible data (not for the hidden data, though). You can read this file using H5PY (see the code provided in mp1.py for examples).
-
run_tests.py -- the autograder will actually run
python run_tests.py -j
, which gives JSON output. During debugging, we recommend using justpython run_tests.py
, which gives plaintext output -- a little more human-readable. The tests are specified in tests/test_visible.py.
How to Submit
- Submit only the one file, mp1.py, on gradescope. Any other files you submit will be ignored.
- You may submit as many times as you like. Your total score (for both visible and hidden data) will be shown. If you get 100%, you're done.
- In general, we will only see the grade of your most recent gradescope submission. We are willing to use your highest gradescope grade, but you have to tell us which one it is.