Initial project documentation for the EDK classification assignment.
- MNIST: implemented for Part 1 and Part 2.
- Iris: under construction.
Key folders/files:
mnist/: MNIST implementation scripts and tests.data/mnist/: MNIST dataset files (.gz).utils.py: shared confusion-matrix and error-rate helpers.report/figures/: report-ready saved figures.
Recommended Python version: 3.10+.
Required packages:
numpyscipymatplotlibscikit-learn(required for Part 2 k-means)
Install example:
pip install numpy scipy matplotlib scikit-learnPlace the following files under data/mnist/:
train-images-idx3-ubyte.gztrain-labels-idx1-ubyte.gzt10k-images-idx3-ubyte.gzt10k-labels-idx1-ubyte.gz
Expected layout:
classification_project/
data/
mnist/
train-images-idx3-ubyte.gz
train-labels-idx1-ubyte.gz
t10k-images-idx3-ubyte.gz
t10k-labels-idx1-ubyte.gz
Script: mnist/part1_nn.py
Run from mnist/:
python part1_nn.py --lite
python part1_nn.py --full
python part1_nn.py --full --quietFlags:
--lite: quick synthetic smoke run (no file outputs).--full: full MNIST run (default behavior if no mode flag is provided).--quiet: suppress metric/confusion-matrix printing.
Notes:
- Full mode creates confusion matrices and image grids under
mnist/results/andreport/figures/. - If plot windows block terminal completion, use:
MPLBACKEND=Agg python part1_nn.py --fullScript: mnist/part2_kmeans.py
Run from mnist/:
python part2_kmeans.py --lite
python part2_kmeans.py --full --clusters 64 --k 7
python part2_kmeans.py --full --clusters 64 --k 7 --quietFlags:
--lite: quick synthetic smoke run (no file outputs).--full: full MNIST run (default behavior if no mode flag is provided).--quiet: suppress metric/confusion-matrix printing.--clusters: templates per class for k-means (default:64).--k: KNN neighbor count for Part 2c (default:7).
Run from mnist/:
python tests/test_part1.py
python tests/test_part2.pyWhat these tests do:
- Validate core logic on small synthetic data.
- Verify chunked processing and output shape constraints.
- Confirm assignment-specific behavior (Euclidean distance, template usage, and pipeline side-effect controls).
- Avoid heavy full-dataset runtime.
Generated outputs are saved under:
mnist/results/confusion_matrices/mnist/results/misclassified_images/report/figures/
Iris section is intentionally minimal for now and will be expanded once the implementation is complete.