An interactive neural-network lab about approximation, confidence, and out-of-distribution inputs.
Open the Calculus Foundations page
Neural networks do not need to understand an input in order to produce a label. A classifier can be highly confident because one output wins the competition among its known classes—even when the input itself is nonsense.
This project makes that failure mode visible. Draw a digit, load a clean template, or create an unfamiliar shape. The lab shows a simulated activation path, class probabilities, and an explicit out-of-distribution warning.
The point is not that every model is useless. The point is more precise: a softmax score is a preference among labels, not a proof that the input belongs to the training distribution.
The new Calculus Foundations page connects the visual intuition to training:
- Δy/Δx is the average slope between two points—the secant line.
- dy/dx is the limiting instantaneous slope—the tangent line.
- ∂y/∂x is a partial derivative when a function has multiple inputs.
- δy/δx is context-dependent notation for a finite variation or perturbation; it is not a universal substitute for a derivative.
Move the slider and watch the secant slope converge toward the tangent slope. That same local-slope idea powers gradient descent when a model updates its parameters to reduce loss.
- Load a clean digit and watch the network produce a sharp output.
- Click Make nonsense and compare the classifier's forced answer with the OOD warning.
- Draw your own shape to see how small changes affect the displayed distribution.
- Read the three lesson cards below the visual: distribution, approximation, and confidence.
The repository began as a Python study of MNIST files and a neural network built while learning the underlying mathematics. The browser experience is a deliberately transparent educational simulation inspired by that work; it is not presented as a newly trained production classifier.
The network panel is no longer a decorative animation. Every redraw comes from a small forward pass:
35 sampled canvas features → 15 ReLU features → 12 ReLU features → 10-class softmax
The first hidden layer measures row density, column density, and simple shape geometry. The second compares those features with the ten digit prototypes, then the softmax turns the resulting logits into probabilities. The weights are fixed and hand-designed for teaching, so the demo makes the mechanics visible without claiming to be a trained MNIST model.
The visual uses a compact hand-tuned demonstration layer so the idea is explorable in a browser with no server, model download, or data upload. The original Python source and MNIST files remain available for continued experimentation.
The H5 file opener now lives inside this repository at labs/h5-file-opener/. It reads the cat-vs-noncat HDF5 dataset and walks through a from-scratch logistic-regression training loop. It is a separate lab folder—not a separate showcase repository—because its dataset, task, and model are different from the handwritten-digit browser demo.
| Lab | Input | Model idea | Status |
|---|---|---|---|
| Handwritten Recognition | MNIST digits | Image parsing and neural-network foundations | Interactive browser showcase |
| H5 / cat-vs-noncat | HDF5 color images | Logistic regression and gradient descent | Included Python learning lab |
The showcase is static:
python -m http.server 8000Then open http://127.0.0.1:8000/.
No package installation is required for the browser lab. The original Python experiment uses NumPy, SciPy, Matplotlib, IPython, Jupyter, pandas, SymPy, and nose as recorded in the historical README.
Handwritten.Recognition.py— reads the MNIST IDX image and label files and prepares image tensorstrain-*.idx*andt10k-*.idx*— MNIST training and test filesmnist.npz— compact NumPy dataset copyindex.html,styles.css,app.js— the browser lablabs/h5-file-opener/— HDF5 image inspection and logistic-regression lab
The browser page is intentionally self-contained. It does not transmit drawings or collect analytics.
The larger question behind this project is how to make uncertainty legible. Better architectures may help, and uncertainty estimation can be improved, but no single confidence number should be mistaken for knowledge.
Inspired by the discussion around out-of-distribution failure and the limits of confident classification.
The calculus explanation is an original interactive recreation inspired by the clear derivative intuition taught in Andrew Ng’s courses. No lecture screenshot is reproduced; the page uses its own curve, notation, and visual treatment.
MIT
