|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This tutorial moves the MLP series from learning a single Boolean function (MLP I / MLP II) to learning a real classification task: vertical vs horizontal lines on a 3×3 pixel grid. The architecture is 9-3-1: 9 inputs (pixels), 3 hidden neurons with ReLU, 1 sigmoid output for binary probability. Despite being small (28 total parameters), this network demonstrates the central idea that makes deep learning work: hidden neurons learn to be feature detectors. After training you'll see specific neurons that "light up" only for horizontal patterns, and others that respond only to verticals — the same mechanism that scales up to recognize objects in CNNs. Sections Mathematical FoundationThe 9-3-1 network computes:
hj = ReLU(Σi=19 wij · xi + bj) for j = 1, 2, 3
y = σ(Σj=13 vj · hj + c) where
The loss is binary cross-entropy: L = −[ t · log(y) + (1 − t) · log(1 − y) ]
where Feature Detection: Why It WorksThe hidden layer has only 3 neurons, so the network is forced to compress its 9-dimensional input into 3 useful features. With 3 horizontal-line examples and 3 vertical-line examples, the most efficient feature set the network can learn is "is this row active" or "is this column active" — exactly the discriminating axes. What to look for after training: open the network diagram and check the per-neuron weights. You should see one hidden neuron with strong positive weights to three pixels in the same row (a horizontal-line detector), and another with strong positive weights to three pixels in the same column (a vertical-line detector). The third neuron usually picks up a refinement or redundancy. This is feature learning in its simplest form — the same mechanism that scales to convolutional filters in CNNs.
Training Setup
SimulationThe interactive simulator is below. Click pixels in the 3×3 grid to draw a pattern and hit Predict to see the network's classification. Click Train to watch hidden neurons gradually specialize as feature detectors, then come back and test your own ambiguous patterns to see how the network handles them. Usage
Parameters
Buttons and Controls
Limitations
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||