MNIST Digit Recognition — V2

Java
JavaScript
HTML
CSS

From-scratch Java MLP (256 → 128, ReLU + Softmax) trained with mini-batch SGD and cross-entropy loss on MNIST, with no external ML libraries. Paired with a responsive web playground for live in-browser sketching, real-time inference, and top-5 prediction visualization.

The end-to-end pipeline is live online — sketch a digit, watch the network classify it: luisapr1.github.io/Digit-Recognition-NN-V2.

Network architecture

Input  : 784 neurons (flattened 28×28)
Hidden : 256 neurons, ReLU
Hidden : 128 neurons, ReLU
Output : 10 logits + Softmax

What I built

Pure-Java training backend

No PyTorch, no TensorFlow, no NumPy — just double[][]. I implemented:

Responsive web playground

A clean HTML/CSS/JS frontend that mirrors the Java preprocessing pipeline pixel-perfectly:

Why this approach

Building a neural network from scratch — instead of calling model.fit() — forces you to actually understand the math. Every class in the code corresponds to a concept on paper: Layer, Neuron, ActivationType, the analytic derivative of ReLU, the combined Softmax + Cross-Entropy gradient. Re-implementing the exact same preprocessing pipeline in JavaScript so the browser can run inference on the Java-trained weights was a satisfying systems-level constraint to satisfy.