UXInteract / task_029 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
2.39 kB

Train and report a tiny MNIST classifier

Use the supplied train-images-idx3-ubyte and train-labels-idx1-ubyte: ten synthetic 8×8 grayscale inputs with labels 0 and 1. Run python3 solve.py in the project root offline. Read IDX headers and verify that the image and label counts agree.

Training and predictions

Normalize each image by dividing pixels by 255 and flattening to 64 values. Shuffle original indices with random.Random(1).shuffle(indices); use the first 80% for training and the remainder for validation in shuffled order. Reproducibly train a 64-input MLP with 16 ReLU hidden units and two linear output logits. Update parameters by backpropagation on cross-entropy; optimizer and iteration count are unrestricted. Use actual learned weights, not a rule-based classifier, nearest-centroid classifier or prefilled predictions.

  • model.json: finite arrays w1 (16×64), b1 (16), w2 (2×16), b2 (2). Predict via the larger logit from w2 * ReLU(w1*x + b1) + b2, choosing 0 on a tie.
  • predictions.csv: exact header index,true_label,predicted_label, then the two validation samples in shuffled order. Use original sample indices, actual IDX labels and the model's predictions.

Report

Write directly openable report.html with at least two distinct source images. Use one <figure> per preview, with 64 visible row-major <rect> pixels in an inline 8×8 SVG grid. Use fill="rgb(g,g,g)" with g = 255 - original_pixel, and show index N, label M for that source image. Identify MNIST, the MLP with 64 inputs and 16 ReLU units, normalization, and the split (for example, “80/20, seed: 1, Train: 8, Validation: 2”). Show accuracy and macro F1 with the label and decimal value together in visible text, to at least five decimal places in [0,1]. Compute macro F1 by averaging the F1s for classes 0 and 1, using zero when a class has a zero denominator. There is no minimum accuracy target.

Acceptance Checklist

  • Running the same input reproducibly yields a trained model and the required validation rows, and changing training data can change the learned parameters. Predictions match the saved model's forward pass.
  • The report identifies the split, transform and network and shows accuracy and macro F1 recomputed from its validation predictions.
  • At least two distinct visible previews match original IDX labels and pixels.