MNIST input
Parses IDX headers and samples, reverses file endianness, normalizes pixels, and constructs target vectors.
Neural networks / Visualization / C
A two-layer MNIST digit classifier implemented from first principles in C, with configurable training and an interactive view into activations and predictions.
A drawn digit moves through the same network used for evaluation, exposing both hidden activations and the final confidence distribution.
02 / Intent
The purpose of dr-ai was not to wrap an existing machine-learning package. It was to make the mechanics concrete: represent the data, perform the matrix operations, propagate activations forward, move error backward, and update the parameters directly.
The revived interface adds a second objective. Instead of reducing the result to one accuracy number, it makes the network inspectable while a user draws inputs of their own.
03 / Architecture
The program follows one explicit data path from binary dataset files to a prediction on screen.
Parses IDX headers and samples, reverses file endianness, normalizes pixels, and constructs target vectors.
Supplies the vector and matrix operations used by training and inference without an external numerical library.
Runs two fully connected sigmoid layers, computes error gradients, and applies weight and bias updates.
Captures drawn input and renders the input grid, hidden units, class confidence, and current prediction.
04 / Engineering decisions
Forward propagation, backpropagation, and parameter updates are ordinary C code. Keeping the network deliberately small makes the learning algorithm readable from end to end.
Training and evaluation use separate portions of the loaded dataset. The current optimized build reproducibly reaches 91.32% on its held-out 10,000-sample split after one epoch with 16 hidden units.
The interactive view renders more than the winning class. Hidden activations and the complete output distribution reveal how the network responds as the input changes.
05 / Current reality
dr-ai is an educational experiment, not a modern deep-learning system. It uses a small two-layer sigmoid network, a simple training loop, and no acceleration or established ML framework. The verified 91.32% result refers to the project’s own held-out split, not the official MNIST test dataset.