How to read the neural network graphs
A classifier graph can show several things at once: the inputs, the scores a network computes, and the regions where it predicts each class. Add a third dimension and those parts can overlap, making a simple calculation surprisingly hard to read.
We will build the picture one part at a time, using four apples described by two measurements. Then we will read the animations that show a hidden layer changing their representations. The companion article, what a weight matrix actually does, develops the matrix calculations and explains why they solve XOR. Here, the focus is how those calculations become a graph, and how to explore it with the controls.
From two measurements to a point
Each apple has a color score and a softness score . The illustrative measurements are centered around reference levels: negative values mean greener or firmer; positive values mean redder or softer. One pair of measurements locates one apple.
| Apple | Color () | Softness () | Known label |
|---|---|---|---|
| A | Unripe (0) | ||
| B | Unripe (0) | ||
| C | Ripe (1) | ||
| D | Ripe (1) |
The widget starts in Score heights with an angled view. Use Top view (2D) first to locate the four apples, then return to Angled view (3D) as we add the score dimension below.
Each apple keeps its input position on the sheet and gets a second marker at its score height. The dotted line connects them.
s(x) = 1.00x₁ + 1.00x₂ − 0.50
Weights and bias set each apple's score height. The apples' color and softness coordinates stay fixed.
Drag to rotate, or focus the plot and use arrow keys.
| Apple | (x₁, x₂) | Label | Score |
|---|---|---|---|
| A | (-1.0, -0.5) | 0 | -2.00 |
| B | (-0.5, 0.5) | 0 | -0.50 |
| C | (0.5, 0.5) | 1 | 0.50 |
| D | (1.0, 0.0) | 1 | 0.50 |
In the top view, moving right increases color and moving up increases softness. Both measurements belong to the same horizontal input plane. Its orange outline encloses the portion of that plane shown in the graph. Each location inside it represents a combination of color and softness, whether or not our dataset contains an apple there.
The orange border helps us recognize the input sheet when we rotate the camera. It is the edge of the displayed window; it does not separate the classes.
Give each apple a score height
Our single neuron computes
At the initial settings, and . Apple C, at , receives the score .
To draw that calculation in three dimensions, place a small hollow marker at and a filled marker at . A dotted connector joins them. The two horizontal coordinates stay the same; the vertical coordinate records the output. For apple A, whose score is , the filled marker sits below the input sheet.
The two markers show one apple in two roles: its input position and its computed score. A point appears on the input sheet because we placed its input there at height zero. Its score marker lies on the graph of the score function. They coincide in three dimensions only when its score is zero.
The yellow score axis measures this height. It is an axis with numerical ticks, just as and are axes. The classifier still receives only two measurements. Score heights are outputs, and their magnitudes are not probabilities.
In Score heights, the sheet stays neutral so you can follow the four dotted connectors without the full score surface or class shading. The table supplies the exact values if perspective makes heights difficult to compare.
Extend the scores into a plane
The formula also assigns a score to every position between and beyond our four examples. Drawing all the triples
produces a plane. Switch to Decision regions to add the blue score plane, the class shading, and the white decision boundary.
We now have two sheets with different meanings:
| Part of the graph | What it represents |
|---|---|
| Orange-outlined input sheet | The input coordinates, drawn at score zero |
| Blue score plane | The neuron’s output height over each input position |
| White dashed intersection | Inputs whose score is exactly zero |
| Teal region on the input sheet | Inputs predicted unripe: score zero or negative |
| Coral region on the input sheet | Inputs predicted ripe: positive score |
The classifier is the computation followed by the threshold. The blue plane displays its scores; the shading displays its predictions. Above the zero sheet, scores are positive. Below it, they are negative. At the crossing, the score is zero and our threshold assigns class 0.
This explains why a function with two inputs can still have a line as its decision boundary. The function’s graph is a plane in three dimensions. Setting its output to zero selects a line where that plane intersects the input sheet, provided at least one weight is nonzero.
The filled markers retain their known labels: teal circles for unripe, coral squares for ripe. The background reports the model’s prediction. A pink ring marks a disagreement—for example, a teal apple inside a coral region. A–D identify individual apples within the two classes.
Look down, rotate, and reveal the planes
Switch to Top view (2D) while keeping Decision regions selected. Looking straight down the score axis removes height from the picture. Each apple’s input and score markers project to the same position, leaving the familiar diagram of points and decision regions. The widget suppresses the blue score surface in this view so the regions remain visible.
Switch back to Angled view (3D) to recover the heights. Drag the plot to rotate freely, or focus it and use the arrow keys. Rotation changes the viewpoint; all coordinates, scores, and predictions remain the same.
If the sheets are hard to distinguish, use the controls under Show planes:
- Input plane controls the orange-outlined sheet and its decision regions.
- Score plane controls the blue surface that carries the scores.
- Hide overlapping parts makes the surfaces opaque, so nearer parts cover farther ones.
The apple markers remain visible as guides when you hide a plane or obscure it behind another. Their visibility helps track an apple through the picture; it does not mean the apple belongs to two different datasets.
For a first inspection, hide the score plane, identify the input sheet, and then restore it. Follow one dotted connector from a hollow input marker to its filled score marker. Once those two positions are clear, the intersection and shaded regions become easier to read.
What changing the parameters moves
The sliders set weights and bias. They leave the apples’ measured coordinates fixed. Changing changes how strongly color contributes to each score; changing changes the contribution of softness. These changes tilt the score plane. Changing only raises or lowers it without changing its tilt.
Three short experiments connect the two views:
- Keep and set . The score becomes independent of softness. In top view, the decision boundary is vertical: .
- Select Reset, then change only . In 3D the score plane rises or falls; in 2D its intersection with the input plane slides parallel to itself.
- Set both weights to zero. Every input receives the constant score . For a nonzero bias, the planes do not intersect. If the bias is also zero, the score plane coincides with the input plane and every score is zero.
Reset restores and . It preserves the camera and display choices. In the XOR widget below, it also returns to the single-neuron model.
These controls distinguish changes to the model from changes to the view. A weight slider can change an apple’s prediction. Rotating the camera or hiding a surface changes how we inspect the existing prediction.
When the score surface folds: XOR
Now change the illustrative measurements while retaining the labels. The new positions put each class on a diagonal of a square:
| Apple | Color () | Softness () | Known label |
|---|---|---|---|
| A | Unripe (0) | ||
| B | Unripe (0) | ||
| C | Ripe (1) | ||
| D | Ripe (1) |
These invented values make the XOR pattern; they are not a real rule for apple ripeness. The widget opens with the same single-neuron parameters as before. In Top view (2D), try moving its boundary with the weight and bias sliders.
The blue plane shows scores for all inputs. The white line marks score 0; teal and coral regions show the predicted classes.
s(x) = 1.00x₁ + 1.00x₂ − 0.50
Weights tilt the blue score plane; bias raises or lowers it. The apples' color and softness coordinates stay fixed.
Drag to rotate, or focus the plot and use arrow keys.
1 of 4 correct
Adjust the sliders from any angle. Top view (2D) shows the decision regions; changing only the bias slides their boundary parallel to itself.
| Apple | (x₁, x₂) | Label | Score | Prediction |
|---|---|---|---|---|
| A | (-0.5, -0.5) | 0 | -1.50 | 0 |
| B | (0.5, 0.5) | 0 | 0.50 | 1 ✗ |
| C | (-0.5, 0.5) | 1 | -0.50 | 0 ✗ |
| D | (0.5, -0.5) | 1 | -0.50 | 0 ✗ |
The initial parameters get only one of four labels right. Setting , while leaving and , reaches three of four. No single straight line can separate the two diagonals. The dotted segments connect each class’s examples; their crossing marks the obstruction explained in the matrix article.
Select Hidden-layer network. This loads the fixed, hand-chosen two-neuron solution and opens its decision regions in top view. The complete network computes
Its zero-score boundary consists of two parallel lines, . The teal band between them predicts unripe, and both coral regions outside predict ripe. Three regions can encode two classes: the two outer regions share a label. All four apples now receive the correct prediction at their original input positions.
Switch to Angled view (3D). The blue score surface folds along , where the absolute value changes slope. Its two sides cross the zero sheet along the two white lines. The crease and the decision boundaries have different meanings: the crease marks a change of slope; the white lines mark a change of class.
This graph still uses original input coordinates plus output score. To see the intermediate coordinates produced by the hidden layer, we need the next kind of diagram.
Follow a vector through the weight matrix
This guide uses an alternative hand-chosen solution with dependent columns. The matrix article uses independent columns with off-diagonal weights ; both networks solve the same four-point problem. Here, the hidden layer uses
Its columns give the destinations of the input basis vectors: lands at , and lands at . The animation draws those destinations and follows one apple alongside them.
Solid yellow and blue arrows follow e₁ and e₂. The dashed teal arrow follows apple A. Faint marks show their starting positions. The animation shows the movement to their images under W; W stays fixed.
Select Transform. The solid yellow and blue arrows track the two basis-vector images. The dashed teal or coral arrow tracks the selected apple, starting with A. At every frame, the apple’s displayed vector equals the two displayed basis arrows scaled by its original coordinates and added together.
A starts at and ends at the origin: its two contributions cancel. B also ends at the origin. C ends at , while D ends at . Their labels and identities stay the same throughout.
Choosing another apple stops the animation and resets the progress to its original position. Select Transform again, or drag the slider to inspect a particular stage. You can pause and resume; Reset returns the currently selected apple to the start.
The movement illustrates applying a fixed matrix. The intermediate frames interpolate from the identity map to ; they are not weight updates produced by training. The column-by-column calculation explains the same rule for combining the columns, using the matrix article’s weights.
Follow the whole grid through the hidden layer
A matrix acts on every input vector, so we can apply it to a grid as well as to four examples. The next widget keeps the original input plot on the left and shows the transformed coordinates on the right.
Each apple is one row of X. Its vector has two coordinates; both rows of W act on it.
Dashed white arrow and white ring: selected apple’s vector and endpoint. Yellow and blue arrows: input basis vectors and their images, shown up to W.
Blue: transformed input grid. Faint grid: fixed coordinate reference.
The animation shows the change between stages; the network computes each stage directly. Intermediate positions are only for visualization.
Wₜ = [[1, 0.00], [0.00, 1]]; b = (0, 0)
Start: the input coordinates
The class diagonals cross at the origin. The yellow and blue arrows are the two input basis vectors; the dashed white arrow follows the selected apple.
Apple C: one vector, two coordinates
Input x = (-0.50, 0.50) → current x = (-0.50, 0.50)
Select Multiply by W to see how each row computes one new coordinate.
| Point | Input x | Current x |
|---|---|---|
| A | (-0.50, -0.50) | (-0.50, -0.50) |
| B | (0.50, 0.50) | (0.50, 0.50) |
| C | (-0.50, 0.50) | (-0.50, 0.50) |
| D | (0.50, -0.50) | (0.50, -0.50) |
Start with apple C, which is selected initially. Its dashed white arrow and white ring identify the vector and endpoint in both plots. Yellow and blue arrows track the basis vectors up to the matrix stage. The blue grid is the transformed input grid; the faint background grid remains fixed as a coordinate reference.
The three buttons select exact stages of the forward pass:
| Stage | What is drawn on the right |
|---|---|
| Input | The original points and square grid |
| Multiply by W | The pre-activation coordinates ; the grid collapses onto one diagonal |
| Apply ReLU | Negative coordinates become zero; the diagonal becomes two positive rays, with a straight output boundary |
At Multiply by W, the grid can appear to disappear. Every output satisfies , so all its transformed lines overlap on the same diagonal. The bright blue line is the grid’s collapsed image. This is the visible effect of the matrix having rank one.
At Apply ReLU, one half of that diagonal lands on the positive horizontal axis and the other on the positive vertical axis. Those two blue rays are the transformed grid. The background reference grid stays square because it supplies the coordinates in which we read the result.
The slider supplies intermediate drawings between these operations. The stage buttons land on the actual results calculated by the network; the movement between them helps make the change visible. Selecting A, B, C, or D changes which example the calculation below the plots follows.
In this hidden space, the output boundary is the single line . In the earlier XOR graph, the same decision appeared as two lines in the original input space. Check the axes to tell which representation you are looking at. Each new apple still arrives with its original measurements. The hidden layer computes new coordinates from them, and the output neuron uses those coordinates to decide.
When height represents a new feature
There is one more use of a third dimension in the matrix article. Instead of drawing the output score as height, we append a derived input feature:
Keep x₃ = x₁x₂ selected and move lift from zero to one. The horizontal positions stay fixed. A and B rise to ; C and D descend to . The plane separates the classes. Drag to inspect their heights from another angle; height is drawn at four times the horizontal scale, as indicated below the graph.
Select x₃ = 0 to replace the product feature with a constant zero. All four points remain in the original plane, even at full lift. The useful change was computing the product, rather than merely providing another coordinate slot.
Here the third axis belongs to a three-coordinate feature representation. In the earlier classifier graph, it showed an output score over two input coordinates. The drawings look similar, but their axis labels tell us which computation they represent.
Continue with the matrix mechanics behind these transformations, or explore how training wider hidden layers changes the boundary.