# MNIST training and source-image montage Build an offline Python classifier using the provided tiny IDX files `train-images-idx3-ubyte` and `train-labels-idx1-ubyte`. Run `python3 solve.py` from the project root. Load the matched 8×8 grayscale samples and labels; do not download MNIST. ## Model and validation Shuffle original sample indices with `random.Random(1).shuffle(indices)` and use the first 80% for training and the remaining 20% for validation in shuffled order. Divide model input pixels by 255. Train a genuine cross-entropy MLP with 64 inputs, a 16-unit ReLU hidden layer, and two linear logits; update weights by backpropagation. Epoch count and optimizer are unrestricted. Do not substitute fixed predictions or a non-MLP classifier. No minimum score is required. - `model.json`: finite numeric arrays `w1` (16×64), `b1` (16), `w2` (2×16) and `b2` (2). Predict from `argmax(w2*ReLU(w1*x+b1)+b2)`, choosing 0 on a tie. - `predictions.csv`: exact header `index,true_label,predicted_label`. Include only the validation indices in shuffled order with their IDX labels and predicted classes. ## Visualization and report Save `mnist_samples.png` as a 40×8, 8-bit grayscale PNG: place the first five raw 8×8 images left to right, keeping their original byte values. Do not normalize or augment the display pixels. In `report.html`, display `` at proportional dimensions of at least 200×40 CSS pixels. Describe the dataset, normalization and network structure; show the 80/20 split and the labeled counts “Train: 8” and “Validation: 2”. Report the accuracy from the CSV as `Validation accuracy: `, not a percentage. ## Acceptance Checklist - Learned parameters and predictions are generated from the current IDX input. The validation order and labels match the split, and the saved model reproduces each prediction. - The montage preserves every raw pixel and displays legibly at the specified scale. - Described split, transforms, network and accuracy agree with the generated artifacts. Changed training labels and image pixels yield corresponding model and montage changes.