Lesson 2 of 13 in this unit
What does this neuron notice?
Draw an image with 25 pixels, inspect each weight, and see what makes a detector respond.
By the end: Calculate a weighted feature response and distinguish a detector’s response from a human interpretation.
Prerequisites and path options
Why learn this? Inspect which input patterns change a prediction so you can question what an image model has learned.
Start with something concrete.
A tiny image is just a grid of numbers. A bright pixel is 1 and a dark pixel is 0. Can one neuron notice a vertical stroke? Load a line, then a cross, and look at which inputs contribute to the score.
Try the interactive modelA detector gives positive weight to the center column. Will a cross necessarily produce a low response?
Change one thing. Watch what follows.
Loading this browser experiment…
Understand what changed.
A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.
The idea in everyday terms
An image can be represented by a grid of brightness numbers. Multiply each brightness by its weight, add the results and a bias, then pass the total through a function called sigmoid. Sigmoid puts the output between zero and one. The weight pattern determines which bright pixels raise or lower the score.
What to watch in the experiment
Change the image and inspect the contribution of individual pixels. A detector that responds to a horizontal stroke can also respond to a plus sign containing that stroke. To learn the distinction, the task and training examples must distinguish those cases.
What this does not establish
An activation is evidence about this calculation, not proof that a neuron understands an object. An output between zero and one is not automatically a well-calibrated probability.
Open the full worked examples, calculations and limitations
This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.
Multiply, add, and interpret carefully
A 5 × 5 image becomes 25 brightness inputs. The neuron multiplies each by a weight, adds the products and a bias, then applies a sigmoid. A sigmoid maps a score to a number between 0 and 1. We interpret that number as a predicted probability of the selected positive class, although it has not been calibrated on independent data.
The initial vertical template uses +1 in the center column, −0.25 elsewhere, and bias −2. A vertical line contributes 5, giving score 3 and sigmoid output about 0.953. A cross also contains the vertical stroke. Its four extra bright pixels subtract 1, leaving score 2 and output about 0.881. “Contains a vertical line” and “is exclusively a vertical line” are different tasks.
The starting weights are a hand-written teaching template. The editor lets you inspect that mechanism directly. Changing a weight by hand is not learning; the learning-step button in the lab performs an actual gradient update for the current labeled image.
How a feature can be learned
For a binary classifier, cross-entropy penalizes assigning little probability to the correct class. If the target is 1, a probability near zero is costly. If the target is 0, a probability near one is costly. With a sigmoid output and this loss, the weight gradient has a simple form:
A dark pixel has input zero, so its weight gradient is zero for this example. A bright pixel contributes the prediction error. The optimizer subtracts learning rate times each gradient, using the same old parameter values. The lab’s rate is 0.1; both weights and bias update together.
Repeated training on varied labeled examples can strengthen useful patterns. Training on just the displayed image can overfit it and alter the response to other images. Try labeling a cross as negative, taking one step, and returning to the vertical line. Lower loss on one example is not proof that the detector has learned the intended task.
Features are not always individual neurons
Hidden features emerge because they help the final objective; programmers need not name each intermediate feature. In a larger network, one feature may be spread across many dimensions, and one neuron may contribute to several features. A strong activation is evidence of a response, not a complete explanation of a concept.
Interpretability researchers measure activations and intervene on parts of the computation to test hypotheses about their roles. Methods such as sparse autoencoders try to separate mixed activations into a larger set of sparsely used features. Their outputs are useful hypotheses, not guaranteed unique dictionaries of the model’s concepts.
Transfer the source exercise to a 3 × 3 image
Give the three middle-row pixels weight +1 and the other six weight −0.25. With bias −1, a horizontal line has score 2. A plus sign adds two negatively weighted pixels, giving score 1.5. Both still activate the sigmoid strongly. To distinguish “has a horizontal stroke” from “is only a horizontal stroke,” you need a task definition and examples that separate them.
A bright pixel has weight 0.5 and the current predicted probability is 0.8. Its target is 0. With learning rate 0.1, what is the new weight?
Take this idea with you.
A detector responds to a numerical pattern. Labels such as “vertical line neuron” are interpretations to test, not complete descriptions of everything the neuron can do.
Explore related topics and the topic map
How this topic connects
Explore this topic on the interactive mapUse these connections to review a foundation or choose where to go next. You can open any topic without completing the others.
What it builds on
- Backpropagation
Trace a wrong update to its source so you can debug learning code and distinguish calculating gradients from changing weights.
- Hidden layers
See why adding a hidden layer can solve patterns a straight boundary cannot, before paying for a larger model.
Draw an image with 25 pixels, inspect each weight, and see what makes a detector respond.
What it enables
- Slide a detector across an image
Understand how shared filters detect patterns across an image without learning a separate rule for every location.