A single neuron
A parameterized unit combines inputs; the pilot begins with a scalar affine prediction.
Lesson 1 in this unit
Every neural network starts somewhere. Meet its smallest building block—and teach it to make a better prediction.
By the end, you’ll explain how changing a weight or bias changes a prediction.
A shop sells identical items. The total price depends on how many you buy. Our model makes a guess using two numbers: a weight and a bias.
Keep the input at 2 and the bias at 0. Before touching the sliders, take a guess.
Move the weight and bias sliders. Then try One step to see how training changes them, or Run 150 training steps for a bounded training run. The worked film is separate from training.
— Model line● Example prices■ Current prediction
Dashed gaps show errors. Fixed axes let you compare changes honestly.
Try setting input to zero. Which parameter still affects the prediction?
Weight is the line’s slope; bias is its value at zero items. This neuron has a linear output: no additional activation changes the sum.
Saved on this device · CPU · learning rate 0.02
Teaching example: the invented shop rule is 3 credits per item + 2 credits. Moving a slider or switching views does not itself demonstrate understanding. Try and Read use the same model values.
The dots are example prices. The line is your model. Dashed gaps show its errors. All calculations run in your browser.
Use a connection to review, then return. These links never lock lessons or award mastery.
A parameterized unit combines inputs; the pilot begins with a scalar affine prediction.
A single neuron can review Linear and affine functions.
The first neuron begins with input times weight plus bias. Comparing weight with slope and bias with a starting value makes that calculation visible.
Neural networks extends A single neuron.
Trace one parameterized unit before composing layers. The XOR lesson then shows why nonlinear activations matter: stacking affine rules alone still gives an affine rule.
11 concepts in this cross-subject pilot, not a complete curriculum graph. The existing AI lesson map and progress records remain separate and available below or through AI discovery.
A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.
A neuron is a small calculation with adjustable numbers. In the shop example, multiply the number of items by the price per item, then add the packing fee. The model calls these two adjustable numbers the weight and bias. Increasing the weight makes the price rise faster as you add items; increasing the bias adds the same amount to every prediction.
For three items at three credits each and a two-credit packing fee, the prediction is 3 × 3 + 2 = 11 credits. The playground’s four supplied prices are 5, 8, 11 and 14 credits for one through four items.
Learning compares predicted prices with the supplied prices, measures the mistakes and adjusts both numbers. The error score here is the average of squared mistakes. A large mistake therefore matters more than a small one.
Fitting these four fictional prices does not prove that the model will predict other prices well. Its straight line cannot express every possible pattern.
This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.
Imagine a shop where every item costs the same amount, plus a fixed packing fee. A simple model can estimate the total price from the number of items.
It needs just two adjustable numbers: a weight for the price per item, and a bias for the fixed fee. Together, they form our first neuron.
This is a made-up price example designed to make every calculation visible. Real prices depend on many more things.
In the playground, the four example prices are 5, 8, 11, and 14 credits for one through four items. The model begins with a poor guess: a weight of 1 and a bias of 0.
Training compares its predictions with the examples. It measures the errors, calculates how the weight and bias affect those errors, and adjusts both a little. Repeating this process is gradient descent.
This lesson uses a neuron with a linear output: its graph is a straight line. Later, we’ll add nonlinear activation functions and connect neurons into layers, so the network can represent more complicated patterns.
A perfect fit to these four examples only tells us the model fits this tiny training set. We still need new examples to check generalization.
For each example, calculate prediction minus target. The weight gradient averages twice that error times the input; the bias gradient averages twice the error. Both updates use the same old parameters.
At weight 1 and bias 0, the gradients are −40 and −14. One step gives weight 1.8 and bias 0.28. The average squared error falls from 54 to 24.0784.
Set aside the playground values. A model has weight = 3 and bias = 2. What will it predict for 3 items?
A neuron combines inputs with a weight and a bias. Learning adjusts those parameters to reduce error. A network connects many of these computations.
Why some updates improve a model—and others go too far.
Use these connections to review a foundation or choose where to go next. You can open any topic without completing the others.
Substitute input values into a formula and keep track of which quantities change. This makes the lesson’s worked calculations easier to follow.
Turn inputs, a weight, and a bias into a prediction.
See why adding a hidden layer can solve patterns a straight boundary cannot, before paying for a larger model.
Explore how action limits and smooth control affect a physical system’s response.