HomeAI & Machine LearningUniversal Approximation Theorem: Neurons Fitting a Curve (2D)

Universal Approximation Theorem: Neurons Fitting a Curve (2D)

A 2D multi-panel view of a single hidden layer of sigmoid neurons learning, live, to approximate a target curve via real batch gradient descent — function fit, per-neuron ridgeline, loss history and a draggable weight-space scatter, all updating every training step.

AI & Machine Learning2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-deep-learning-data-science ↗ Open standalone

This simulator makes the core promise of deep learning visible: a single hidden layer of sigmoid neurons, trained live by batch gradient descent, learning to reconstruct an arbitrary target curve one small weight update at a time. Rather than a single 3D scene, this version spreads the same live computation across four linked 2D panels — the network's live fit against the target curve, a ridgeline unstacking every individual neuron's own S-shaped contribution, a scrolling loss-history chart, and a draggable, zoomable weight-space scatter of every neuron's own slope and shift. Drag the neuron-count slider down and the network visibly loses the ability to represent sharp features — drag it up and the fit sharpens, exactly as the Universal Approximation Theorem predicts.

⚙ Under the hood

A 2D multi-panel view of a single hidden layer of sigmoid neurons learning, live, to approximate a target curve via real batch gradient descent — function fit, per-neuron ridgeline, loss history and a draggable weight-space scatter, all updating every training step, mirroring the same mechanism as the 3D version.

deep learningneural networkgradient descentbackpropagationsigmoiduniversal approximation

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)