This repository is a starter kit for the final programming project.
You will implement:
power_methodfor the dominant eigenvalue/eigenvector of a symmetric matrix.svd_compressfor rank-k image approximation using SVD.svd_featuresto build feature vectors from image singular values.lda_trainto train a two-class Linear Discriminant Analysis (LDA) classifier.lda_predictto apply the trained LDA classifier.
The autograder will import project.py and call these functions with specific
signatures. Do not change the function names or signatures.
project.py— main implementation file with function stubs.project_data_example.npz— tiny synthetic dataset for local testing.requirements.txt— minimal Python dependencies..gitignore— standard Python ignores.
-
Create a virtual environment (optional but recommended).
-
Install dependencies:
pip install -r requirements.txt
-
Open
project.pyand implement each function where indicated. -
Try running the self-test:
python project.py
This will:
- Load
project_data_example.npzif present. - Extract SVD features.
- Train an LDA classifier.
- Print the test accuracy on the tiny synthetic dataset.
- Load
In the real assignment, the Gradescope autograder will provide a different
project_data.npz with more realistic images and labels.