Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 1 in this unit

Understand Neural NetworksTHE BUILDING BLOCKS

Why do weight and bias change the answer differently?

Every neural network starts somewhere. Meet its smallest building block—and teach it to make a better prediction.

About 15 minutesInteractive lessonBeginner friendly

By the end, you’ll explain how changing a weight or bias changes a prediction.

Path options and starting ideas
01TRY SOMETHING SIMPLE

Can a number learn a pattern?

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.

A RULE YOU CAN SEE

Build a basket.

Add a notebook. What changes—and what stays the same?

2 notebooks
2-credit fixed feeSame for every basket
INPUT × WEIGHT2 × 3 = 62 items at 3 credits each
BIAS2Fixed packing fee
OUTPUT8 creditsTotal price

An invented shop rule: 3 credits per notebook, plus 2 per order—even an empty one. This picture shows the target pattern; the playground model will learn it from examples.

prediction=w⏟weight×x⏟input+b⏟bias\text{prediction} = \underbrace{w}_{\text{weight}} \times \underbrace{x}_{\text{input}} + \underbrace{b}_{\text{bias}}
A little rusty on equations? Take a quick refresher and come right back.
02MAKE A PREDICTION

What happens if we increase the weight?

Keep the input at 2 and the bias at 0. Before touching the sliders, take a guess.

03LEARN WITH YOUR HANDS

Make the neuron your own.

Open standalone

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.

From a basket to a prediction

One rule. Every input.

Your live playground values
  1. 1 · Input2items in the basket
  2. 2 · Multiply by weight2.002 × 1.00 credits
  3. 3 · Add bias → prediction2.002.00 + (0.00) credits
Price (credits)-40816242801234Number of items

— 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.

Mean squared error54.00across four example prices
Training steps0recorded by the playground

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.

CONNECTED IDEAS · SMALL PILOT CLUSTER

Find the idea you need

Use a connection to review, then return. These links never lock lessons or award mastery.

  1. Linear and affine functions

    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.

  2. Neural networks

    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.

Open the full local map and resource list

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.

04CONNECT THE DOTS
ANIMATED WALKTHROUGH

Follow a number through a neuron.

1 / 4
INPUT2notebooks1
× WEIGHT2 × 36 credits2
+ BIAS6 + 28 credits3
OUTPUT8predicted credits4

Worked example · input 2, weight 3, bias 2 · separate from your playground

Start with 2 notebooks. The input tells the neuron how many items are in the basket.

READ & CONNECT

Understand what changed.

Back to the experiment

A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.

Same learning goal in both modes: Explain how changing a weight or bias changes a prediction.

The idea in everyday terms

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.

What to watch in the experiment

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.

What this does not establish

Fitting these four fictional prices does not prove that the model will predict other prices well. Its straight line cannot express every possible pattern.

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.

A small calculation with a big job

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.

What is actually learning?

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.

  • Weight changes the slope. A larger weight adds more to the prediction for each extra item.
  • Bias changes the starting point. It raises or lowers every prediction by the same amount.
  • Loss measures the mistakes. Here, we average the squared errors across all four examples. Large mistakes count more.

One neuron is a starting point

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.

Go deeper: see one learning update

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.

wnew=w−0.02 ∂L∂ww_{\text{new}} = w - 0.02\,\frac{\partial L}{\partial w}bnew=b−0.02 ∂L∂bb_{\text{new}} = b - 0.02\,\frac{\partial L}{\partial b}

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.

MAKE THE MISTAKES VISIBLE

Why do we square the error?

Choose an example. Each square’s area represents its squared error.

Change the model
MODEL PREDICTION2.00
EXAMPLE PRICE8.00
SIGNED ERROR-6.00
SQUARE IT(-6.00)² = 36.00

The model predicts 6.00 credits too low. Squaring makes both negative and positive errors nonnegative. Doubling an error makes its square four times as large.

AVERAGE ALL FOUR SQUARES216.00 ÷ 4 = 54.00

This is the playground’s mean squared error. All four examples count, not only the one selected.

Linked to your playground: weight 1.00, bias 0.00. Squares share one scale: side length shows absolute error; area shows squared error.

05YOUR TURN
Check your understanding

A new prediction. Same idea.

Set aside the playground values. A model has weight = 3 and bias = 2. What will it predict for 3 items?

credits
What does the bias do?
06TAKE IT WITH YOU

You’ve met the smallest building block.

A neuron combines inputs with a weight and a bias. Learning adjusts those parameters to reduce error. A network connects many of these computations.

My Learning
NEXT IN THIS MODULE

Loss functions & gradient descent

Why some updates improve a model—and others go too far.

Open
Explore related topics and the topic map

How this topic connects

Explore this topic on the interactive map

Use 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

  • Algebra

    Substitute input values into a formula and keep track of which quantities change. This makes the lesson’s worked calculations easier to follow.

You are hereYour first neuron

Turn inputs, a weight, and a bias into a prediction.

What it enables

Adapted from ebook lessons 1–2.Read the source